Hey,
I finally did it. I made a DMX receiver!
This project reads in the first 8 byte of the DMX code and puts it by PWM on Port D(0-7). It is made for the 16F877A.
The code is not yet optimal, but it works!
I'll try to make it better so that it can be easily used (and changed) in Flowcode.
Enjoy this code!
DMX 512 8 byte receiver (Component)
DMX 512 8 byte receiver (Component)
- Attachments
-
- DMX.fcf
- (6 KiB) Downloaded 1454 times
Last edited by Jaspervdw on Fri Mar 20, 2009 11:38 am, edited 1 time in total.
Re: DMX 512 (8 byte reading and pwm on port D)
Hey,
As promised is here a better version of the DMX512 receiver. I put it in the component (Custom component).
The component has two functions.
- SetAdress:
This function allow you to set the 8 bytes you want to read from the DMX channel. the value of this addresses must be between 1-512 (0x001 - 0x200).
- ReadByte:
This function allow you to read the DMX value at the previous specified address and put it in a byte.
Example:
SetAdress(0x01,0x02,0x13,0x14,0x15,0x16,0x17,0x18);
Readbyte(0); --> reads byte at address 0x01 --> (channel 1);
Readbyte(1): --> reads byte at address 0x02 --> (channel 2);
Readbyte(2); --> reads byte at address 0x13 --> (channel 19);
Enjoy it!
Jasper
As promised is here a better version of the DMX512 receiver. I put it in the component (Custom component).
The component has two functions.
- SetAdress:
This function allow you to set the 8 bytes you want to read from the DMX channel. the value of this addresses must be between 1-512 (0x001 - 0x200).
- ReadByte:
This function allow you to read the DMX value at the previous specified address and put it in a byte.
Example:
SetAdress(0x01,0x02,0x13,0x14,0x15,0x16,0x17,0x18);
Readbyte(0); --> reads byte at address 0x01 --> (channel 1);
Readbyte(1): --> reads byte at address 0x02 --> (channel 2);
Readbyte(2); --> reads byte at address 0x13 --> (channel 19);
Enjoy it!
Jasper
- Attachments
-
- DMX512RX.zip
- (31.36 KiB) Downloaded 1483 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: DMX 512 8 byte receiver (Component)
Great thanks for the code Jasper.
If I get any requests for DMX examples I will forward them to your forum topic.
If I get any requests for DMX examples I will forward them to your forum topic.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: DMX 512 8 byte receiver (Component)
Jasper,
Do you know if your component also works on the ECIO28P (PIC18F2455)?
Are there any external components needed (except a RS-485 to RS-232 convertor which I've already connected)?
I'm trying to show the current value on a set DMX-channel on a LCD-dispay.
So far I'm only getting the value 240 (whatever I send to the channels).
I presumed SetAddress has to be called just once. Am I correct?
Thanks in advance.
Greets,
Desmond
B.t.w: Nice work! I only hope I can get it to work on my uC
Do you know if your component also works on the ECIO28P (PIC18F2455)?
Are there any external components needed (except a RS-485 to RS-232 convertor which I've already connected)?
I'm trying to show the current value on a set DMX-channel on a LCD-dispay.
So far I'm only getting the value 240 (whatever I send to the channels).
I presumed SetAddress has to be called just once. Am I correct?
Thanks in advance.
Greets,
Desmond
B.t.w: Nice work! I only hope I can get it to work on my uC
Re: DMX 512 8 byte receiver (Component)
Desmond,
The problem is probably that your Βµc is running at 4Mhz, the code is made for 20 Mhz.
I don't have enough knowledge (from flowcode) to make the code fit for any oscillation speed.
You can try to adjust the C-code of the component. I think you only have to adjust the baudrate:
SetAdress has to be called once.
Greetings,
Jasper
The problem is probably that your Βµc is running at 4Mhz, the code is made for 20 Mhz.
I don't have enough knowledge (from flowcode) to make the code fit for any oscillation speed.
You can try to adjust the C-code of the component. I think you only have to adjust the baudrate:
Code: Select all
txsta.BRGH = 1; // Set baudrate to high speed (p113)
spbrg = 0x04; // Set Baud Rate Generator Registor to 245760 i.s.o 250000 error 1,70%
Greetings,
Jasper
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: DMX 512 8 byte receiver (Component)
Hello Dizzy, Jasper
For use of the program with the ECIO devices you must create the baud rate to match a 48MHz clock speed.
For a baud rate of 250000 with 0% error the C code should be:
txsta = 4; // Set baudrate to high speed
spbrg = 127; // Set Baud Rate Register
For use of the program with the ECIO devices you must create the baud rate to match a 48MHz clock speed.
For a baud rate of 250000 with 0% error the C code should be:
txsta = 4; // Set baudrate to high speed
spbrg = 127; // Set Baud Rate Register
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: DMX 512 8 byte receiver (Component)
Hi, has anyone got any simple example program as to how this component works?
Re: DMX 512 8 byte receiver (Component)
hello
i put the files in the component folder of flowcode 5, rename them with "FC5_PIC_" in front , but when i try to use the component an error pop up.
as anyone ever succeed with this? is there a version for FC5 ?
best regards
i put the files in the component folder of flowcode 5, rename them with "FC5_PIC_" in front , but when i try to use the component an error pop up.
as anyone ever succeed with this? is there a version for FC5 ?
best regards