View previous topic :: View next topic |
Author |
Message |
arunkish
Joined: 23 Dec 2008 Posts: 83
|
DMX512 Control |
Posted: Mon Jan 31, 2011 6:44 am |
|
|
Hello,
I just received my CW20 scanner and DMX control board from laserpic.com
http://www.laserpic.com/Ebay/DMX%20control%20broad.html The board has DMX512 input A+ B- and Ground. Here is the manual supplied along with the board. http://www.laserpic.com/Product_galvo/LP12K_ch12S_OTC_manual.pdf Honestly I have never used with the DMX512 protocol before. I would like to have a simple code snippet that can control the galvo/scanner to start with. I understand that it is something similar to RS285 protocol. Can someone give me suggestions and help me to start with it.
Thanks again. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Mon Jan 31, 2011 7:08 am |
|
|
Let Google be your friend ! Try searching ' ccs c code dmx512' or similar.There may be an example in the examples folder( I haven't checked).
Create a small program ,just to turn on one function.
Also create a 'table' of defines for all the commands that can be sent. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Mon Jan 31, 2011 7:12 am |
|
|
Also, search for DMX in this forum. Before you start asking in the
future, please try a search first. If you don't find anything then ask. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
arunkish
Joined: 23 Dec 2008 Posts: 83
|
|
Posted: Mon Jan 31, 2011 9:16 am |
|
|
Thank you both for your reply. I did search on the forum. But I was able to find snippets for receiving DMX512 by Mark. I did not find anything that can transmit. And as I said... I don't have any idea about using DMX512. The only option on the board available is A+ B- G (DMX512). There is not much information available in the internet with examples to control a galvo scanner using DMX + PIC Micro. Sorry for bothering you.
Thousands of Thanks |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Mon Jan 31, 2011 10:36 am |
|
|
Interestingly Google gives me a lot of DMX512 info.
Below is a site I found with Google, a great source of info i have used many times
that has virtually everything you might want to know..
http://www.dmx512-online.com
This link on the CCS forum talks about transmit code:
http://www.ccsinfo.com/forum/viewtopic.php?t=43239 _________________ Google and Forum Search are some of your best tools!!!! |
|
|
arunkish
Joined: 23 Dec 2008 Posts: 83
|
|
Posted: Wed Feb 02, 2011 11:21 pm |
|
|
I am trying to use the DMX control using parallel port interface http://users.skynet.be/kristofnys/
I changed the chip to 16F876A, clocked at 4Mhz. Gets compiled successfully, but I do'nt get the output. I checked the connections and it seems ok. I dont know assembly . Can anyone please convert it to CCS please. |
|
|
arunkish
Joined: 23 Dec 2008 Posts: 83
|
|
Posted: Thu Feb 03, 2011 9:25 am |
|
|
I am happy. I got it working. As I said before I am trying to write the same in CCS. I just want to make sure if my understanding is correct.
100 millisecond BREAK (low)
8 ms high)
11 bit (44ms) START CODE ------- Data for Channel 0
4 bit (1ms) BREAK BETWEEN PACKETS (high)
11 bit (44ms) ------ Data for Channel 1
Say for eg, if I have the data as 255 for channel 0, how should I send the 8 bit + 3 bit data to PORTA0 of the chip?
Thanks |
|
|
arunkish
Joined: 23 Dec 2008 Posts: 83
|
|
Posted: Thu Feb 03, 2011 9:07 pm |
|
|
After trying out a lot and lot, still the board does not recognizes the DMX signal. This is the last part of code that I did to test it. I am sure that the timings did not match at all. I dont have a scope.!! Can anyone please help me with this. Just trying to send data for channel1 and channel2. Please
Code: |
#include <16F876A.h>
#fuses XT,NOWDT,PUT,NOBROWNOUT,PROTECT
#use delay(clock=4000000)
#byte PORTA=0x05
#byte TRISA=0x85
#bit DMXOUT=PORTA.0
#byte CH1=255
#byte CH2=150
int i;
void main()
{
set_tris_a(0x00);
PORTA=0xFF;
while(1){
DMXOUT=1;
delay_us(3);
DMXOUT=1;
delay_us(3);
DMXOUT=0;
delay_us(101);
DMXOUT=1;
delay_us(3);
DMXOUT=1;
delay_us(3);
DMXOUT=0;
delay_us(3);
delay_us(35);
DMXOUT=1;
delay_us(3);
DMXOUT=1;
delay_us(3);
DMXOUT=1;
delay_us(3);
DMXOUT=0;
delay_us(3);
for(i=0; i<=7; i++)
{
DMXOUT=1;
delay_us(1);
DMXOUT=0;
delay_us(1);
}
DMXOUT=1;
delay_us(3);
DMXOUT=1;
delay_us(3);
DMXOUT=1;
delay_us(3);
delay_us(3);
}
}
|
|
|
|
vinniewryan
Joined: 29 Jul 2009 Posts: 154 Location: at work
|
|
Posted: Thu Feb 03, 2011 10:25 pm |
|
|
You can get a basic free sound-card based scope online, I don't think I can post a link here but if you do a google search for "Christian Zeitnitz Soundcard Oscilloscope" you'll find the one I used to use in the first few search results. _________________ Vinnie Ryan |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Thu Feb 03, 2011 10:41 pm |
|
|
vinniewryan wrote: | You can get a basic free sound-card based scope online, I don't think I can post a link here but if you do a google search for "Christian Zeitnitz Soundcard Oscilloscope" you'll find the one I used to use in the first few search results. |
I've been using that for about 5yrs now. It's nice.
http://www.zeitnitz.de/Christian/scope_en _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
vinniewryan
Joined: 29 Jul 2009 Posts: 154 Location: at work
|
|
Posted: Thu Feb 03, 2011 11:25 pm |
|
|
It is a very handy tool, great for most serial communication and noise monitoring. I recently found a much more advanced soundcard scope that can go full screen which I prefer now:
http://www.sillanumsoft.org/prod01.htm
Also completely free. _________________ Vinnie Ryan |
|
|
arunkish
Joined: 23 Dec 2008 Posts: 83
|
|
Posted: Thu Feb 03, 2011 11:57 pm |
|
|
Thank you for your reply. I still wonder, how can i use a soundcard to test or measure the voltages or outputs of a chip. What will be the input to the sound card? Anyway, I am working to send the data for two channels in DMX 512 format. Can anyone please help me with that. Struggling hard and my DMX board still does not recognizes the signal.
Thanks a lot. |
|
|
vinniewryan
Joined: 29 Jul 2009 Posts: 154 Location: at work
|
|
Posted: Fri Feb 04, 2011 2:45 am |
|
|
Your DMX board uses EIA-485 communication. Do you have a list of commands your scanner can receive?
Here's a link with info on EIA-485:
http://en.wikipedia.org/wiki/EIA-485
I hope this helps but I'm not experienced with this type of control communication so it's the best I can do until you understand how it works. It's fairly simple to set up and you're on the right path, although I would use a function for outputting information to the DMX instead of writing every single bit independently. In a simple set up you could do something like this:
Code: |
// set each of the 8 bits accordingly in your main function
//example: to send the number 220:
//the bianary representation for 220 is 11011100
//b1=1;
//b2=1;
//b3=0;
//b4=1;
//b5=1;
//b6=1;
//b7=0;
//b8=0;
int1 b1; //bit 1
int1 b2; //bit 2
int1 b3; //bit 3
int1 b4; //bit 4
int1 b5; //bit 5
int1 b6; //bit 6
int1 b7; //bit 7
int1 b8; //bit 8
int8 bitcount;
void xmit(b1,b2,b3,b4,b5,b6,b7,b8)
{
if(bitcount==0) //
{
DMXOUT=1; //start bit?
bitcount++;
}
else if(bitcount==1)
{
DMXOUT=b1;
}
else if(bitcount==2)
{
DMXOUT=b2;
}
else if(bitcount==3)
{
DMXOUT=b3;
}
else if(bitcount==4)
{
DMXOUT=b4;
}
else if(bitcount==5)
{
DMXOUT=b5;
}
else if(bitcount==6)
{
DMXOUT=b6;
}
else if(bitcount==7)
{
DMXOUT=b7;
}
else if(bitcount==8)
{
DMXOUT=b8;
}
else if(bitcount==9)
{
DMXOUT=0; //stop bit?
delay_us(XXX);
bitcount=0;
}
bitcount++;
delay_us(3);
} |
The above code is just an example. In reality I would use an array to hold each bit of information and use a function to convert decimal values to bianary, or #define the known commands as array values for ease of programming and use.
In order to use a sound card Scope, you just need an 1/8" stereo cable with the wires exposed on one end. You can cut the cord off of an old set of headphones or buy one at radioshack. There are 3 wires inside, GND, L, and R. L and R are the left and right audio channels. These are your two inputs for the Scope. Once you have a cord, simply plug it into the 'Line In' input on your computer, connect the bare wires to your microcontroller outputs with a resistor in line, or you can build protection circuitry if you're worried about blowing up your sound card, but for low logic level work I've never had an input spike that was harmful to my coundcard. Sound card scopes are limited to the sampling frequency of your sound card, so if you don't have a 'nice' sound card your sampling rate will typically be 44,100hz. This should be fast enough to accurately monitor your data comms and get a good idea of what's going on with your hardware. I also like to set up headphones so I can hear the data as well and quickly recognize glitches and noise even if I look away for a second.
Cheers! _________________ Vinnie Ryan |
|
|
arunkish
Joined: 23 Dec 2008 Posts: 83
|
|
Posted: Fri Feb 04, 2011 3:27 am |
|
|
Dear vinniewryan
Thank you very much for your info on Soundcard. I will definitely give a try and I hope I am having a better sound card. . EIA-485 ??? But in the manual and the board they had mentioned it as DMX-512. Yesterday, I compiled the assembly code that I mentioned in the previous post and I can see that the board was receiving the data.
The only problem that I have now is I have to change the assembly code I mentioned to CCS and luckily I dont know assembly and ... I'm not an expert. Just a beginner. I can understand that certain rules has to be followed for the DMX512 protocol and I really cant get through it. Just looking for a simple routing to transmit the data of 2 channel will be pretty ok to get started.
Thanks a lot. |
|
|
vinniewryan
Joined: 29 Jul 2009 Posts: 154 Location: at work
|
|
Posted: Fri Feb 04, 2011 8:35 pm |
|
|
How do you know the board is receiving data? Is there an RX LED on the board? DMX-512 uses an integrated EIA-485 protocol. Do you know the speed your communication needs to run at? If you have a link to the data sheet or manual for the communication commands to the DMX board, I would be more than happy to look it over and help you get your communication set up correctly. I saw the manual on the website you linked below, but it had limited information. There is however a .pdf you can purchase from that website which claims to have all the info needed to work with your scanner device. _________________ Vinnie Ryan |
|
|
|