DMX 512 8 byte receiver (Component)

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Jaspervdw
Posts: 12
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

DMX 512 8 byte receiver (Component)

Post by Jaspervdw »

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!
Attachments
DMX.fcf
(6 KiB) Downloaded 1172 times
Last edited by Jaspervdw on Fri Mar 20, 2009 11:38 am, edited 1 time in total.

Jaspervdw
Posts: 12
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: DMX 512 (8 byte reading and pwm on port D)

Post by Jaspervdw »

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
Attachments
DMX512RX.zip
(31.36 KiB) Downloaded 1196 times

User avatar
Benj
Matrix Staff
Posts: 14848
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: DMX 512 8 byte receiver (Component)

Post by Benj »

Great thanks for the code Jasper.

If I get any requests for DMX examples I will forward them to your forum topic.

dizzy_dw
Posts: 1
Joined: Thu Apr 23, 2009 8:25 pm
Contact:

Re: DMX 512 8 byte receiver (Component)

Post by dizzy_dw »

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

Jaspervdw
Posts: 12
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: DMX 512 8 byte receiver (Component)

Post by Jaspervdw »

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:

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%
SetAdress has to be called once.

Greetings,

Jasper

User avatar
Benj
Matrix Staff
Posts: 14848
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: DMX 512 8 byte receiver (Component)

Post by Benj »

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

Jaspervdw
Posts: 12
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: DMX 512 8 byte receiver (Component)

Post by Jaspervdw »

Those this code work with other people?

EPIC
Posts: 1
Joined: Tue Sep 08, 2009 11:51 am
Contact:

Re: DMX 512 8 byte receiver (Component)

Post by EPIC »

Hi, has anyone got any simple example program as to how this component works? :?:

boogui
Posts: 3
Joined: Mon Sep 19, 2011 9:50 pm
Contact:

Re: DMX 512 8 byte receiver (Component)

Post by boogui »

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

Post Reply