Assembly timing woes! Anyone know DMX?
big_mark
Posts: 49
Hi all
I'm in the process of creating a DMX receiver using my propellor kit and I'm having a few problems!
First of all, a little background information. DMX is a communications protocol used in the entertainment industry to control lighting. It uses RS485 balanced transmission, at 250,000 bits per second. The DMX data is sent in 'packets' of upto 513 bytes. The first byte is the start code and is used to define what sort of data is being transmitted. Currently, only zero has been defined as a valid start code. The remaining bytes are used to define channel levels.
A DMX packet is made up of the following parts :
First of all there is the break. This is *at least* 22 consecutive low bits, but could be longer
Then we have the Mark After Break (MAB), which is *at least* 2 high bits, but again could be longer
After that, we have the data frames. There could be *upto* 513 of them (1 start code and 512 data frames), but there could also be less. Each frame starts with 1 low start bit, then 8 data bits, and finally 2 high stop bits. Between each frame there is what is known as the Mark Time Between Frames (MTBF, yes I know....). This can be anywhere from 0 to 1 second and is indicated by consecutive high bits.
The problem I am having is that I think my timing code is wrong. Heres part of my code :
Dmx_clock_step is set to 320 because I have the propellor running at 80Mhz and DMX is transmitted at 250,000 bps, so 80,000,000/250,000 = 320.
I have a little test program set up to display things like break size, MAB size, etc and I am getting what I think are very strange values. I get a consistent 780 bits in the break and 22 bits in the MAB. After that my code does not work and it will not read the rest of the packet correctly. It reads the start bit and 8 low bits of the start code, but does not get any valid stop bits. It continues to read the break and MAB though...
I am using an Analog Devices ADM3485E to interface to a Zero88 Linebacker which I am using to generate the DMX signals.
Many Thanks
Mark
I'm in the process of creating a DMX receiver using my propellor kit and I'm having a few problems!
First of all, a little background information. DMX is a communications protocol used in the entertainment industry to control lighting. It uses RS485 balanced transmission, at 250,000 bits per second. The DMX data is sent in 'packets' of upto 513 bytes. The first byte is the start code and is used to define what sort of data is being transmitted. Currently, only zero has been defined as a valid start code. The remaining bytes are used to define channel levels.
A DMX packet is made up of the following parts :
First of all there is the break. This is *at least* 22 consecutive low bits, but could be longer
Then we have the Mark After Break (MAB), which is *at least* 2 high bits, but again could be longer
After that, we have the data frames. There could be *upto* 513 of them (1 start code and 512 data frames), but there could also be less. Each frame starts with 1 low start bit, then 8 data bits, and finally 2 high stop bits. Between each frame there is what is known as the Mark Time Between Frames (MTBF, yes I know....). This can be anywhere from 0 to 1 second and is indicated by consecutive high bits.
The problem I am having is that I think my timing code is wrong. Heres part of my code :
DAT ' ' ' Assembly program ' org asm_entry mov asm_cnt,cnt ' prepare for WAITCNT loop add asm_cnt,dmx_clock_step :loop waitcnt asm_cnt,dmx_clock_step ' wait for next CNT value (timing is determinant after WAITCNT) mov dmx_bit, ina ' Read input port A
Dmx_clock_step is set to 320 because I have the propellor running at 80Mhz and DMX is transmitted at 250,000 bps, so 80,000,000/250,000 = 320.
I have a little test program set up to display things like break size, MAB size, etc and I am getting what I think are very strange values. I get a consistent 780 bits in the break and 22 bits in the MAB. After that my code does not work and it will not read the rest of the packet correctly. It reads the start bit and 8 low bits of the start code, but does not get any valid stop bits. It continues to read the break and MAB though...
I am using an Analog Devices ADM3485E to interface to a Zero88 Linebacker which I am using to generate the DMX signals.
Many Thanks
Mark
Comments
I've done·DMX receivers in 8052, I used UART in mode 2, I think you must get a driver for UART at 11 bits.
One start bit, 8 data bits (LSB first), and 2 stop bits.
working·with the Propeller serial driver published here, you'll get that DMX reciever work fine and easy !!.
Best regards.
Alberto.
Bear in mind that although it might be looping at a given frequency you may need to syncronize it or something.
Graham
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
Did you see the post I made about DMX? Overall I thought it was fairly simple to create the hardware and software. I have not been back to DMX since I created this post. It would be neat to add RDM support.
http://forums.parallax.com/forums/default.aspx?f=25&m=132052
I used the Propeller manual and example code to cook up my design. I tested it with a handheld DMX unit and a USB DMX unit I have. Things worked great!
Hope this helps,
-Tim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter
tdswieter.com
One little spark is all it takes for an idea to explode
No, I had not seen you DMX code. In fact I didn't even look for any as I had already designed the code on paper before deciding on which processor I was going to use. I must say though, your code is way more efficient than mine is. You've gone about doing it in a way I would never had thought of. Many thanks.
However, I think I have discovered why my code doesn't work. When I ran your demo using my hardware there were fluctuations in the dmx values. I can only assume that my dmx-ttl interface is at fault. I am using an Analog Devices ADM3485E. I chose it because it is designed to run on only 3.3v, therefore simplifying any circuit I might make. I have connected it directly to my Propellor, though I noticed that in Timothys design he has used a 1k resistor between his chip and his Propellor. His dmx-ttl chip runs on 5 volts though, so is that why he has used a resistor?