PDA

View Full Version : DMX Interface



electronicsuk
- 13th July 2005, 14:23
Hello all.
I have been trying to make a DMX interface based on the timing diagram found at http://www.dmx512-online.com/packt.html

Please could somebody point me in the right direction as to how to send DMX using PIC Basic Pro. I am using an RS485 line driver connected to the PIC.

If somebody can give us some example code that would be brilliant.

Thanks,
Matt

DynamoBen
- 13th July 2005, 14:47
Refer to:

http://www.picbasic.co.uk/forum/showthread.php?t=1749

electronicsuk
- 13th July 2005, 14:57
I had already looked though that post and it mostly talks about recieve, there is no code that talks about sending from what i can see.

Thanks,
Matt

DynamoBen
- 13th July 2005, 15:00
Transmitting is going to be similar to receiving. Do you have a in depth knowledge of DMX? If so it should not be too hard to translate the receive code for transmitting.

electronicsuk
- 13th July 2005, 15:13
I honestly can't see where I'm going wrong. Here's a rough outline of what I'm doing:

Set SPBRG to 4, for 250Kbaud @ 20Mhz
Enable asynchronous serial port in RCSTA register
Enable transmit in TXSTA register

Then when it comes to sending data, I start with the DMX break by forcing portb.2 on the 16F627 high for 120uS. Following this is a 12uS MAB during which portb.2 is low. I then transmit a zero value for the start code, and then a number of DMX bytes following that.

I've had no success at all so far, I've tried altering the code so that the serial port is disabled during the time that I force it high/low and then enabling again to send data, I've tried removing the 12uS MAB pause completely, and I've also tried sending portb.2 low for the break and high for the MAB instead of the other way round, but the way I see it, this shouldn't be necessary anyway as the line driver will invert the output.

The most frustrating thing is that I have done this before and had it working fine, but have since lost the code when I formatted my computer. I thought the 75176 rs-485 transceiver could be the culprit, but I've tested it as best I can and it appears to be fine. So in short, I'm stumped.

JEC
- 13th July 2005, 22:22
Methinks you're transmitting backwards.

With the USART off, you need to hold the pin on your PIC high.

You'll swing low for the break, then high for MAB.

Then, if you turn on the USART the pin will be *forced* high, because that's how USARTs do things.

So your startcode and data bytes will be active low as they're trasmitting.

John

electronicsuk
- 15th July 2005, 13:13
Hi John, thanks for the reply. I have tried both high break/low MAB and low break/high MAB with no success, but I will give it another shot when I next get some time to work on this circuit.

Cheers,

Matthew