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

Jaspervdw
Posts: 12
Joined: Fri Dec 12, 2008 4:45 pm
Been thanked: 3 times
Contact:

DMX 512 8 byte receiver (Component)

Postby Jaspervdw » Sun Mar 15, 2009 8:09 pm

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 1072 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
Been thanked: 3 times
Contact:

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

Postby Jaspervdw » Fri Mar 20, 2009 11:22 am

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 1092 times

User avatar
Benj
Matrix Staff
Posts: 13399
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 3941 times
Been thanked: 3750 times
Contact:

Re: DMX 512 8 byte receiver (Component)

Postby Benj » Fri Mar 20, 2009 1:24 pm

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)

Postby dizzy_dw » Sat Apr 25, 2009 12:29 pm

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
Been thanked: 3 times
Contact:

Re: DMX 512 8 byte receiver (Component)

Postby Jaspervdw » Sat Apr 25, 2009 2:34 pm

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: 13399
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 3941 times
Been thanked: 3750 times
Contact:

Re: DMX 512 8 byte receiver (Component)

Postby Benj » Mon Apr 27, 2009 8:33 am

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
Been thanked: 3 times
Contact:

Re: DMX 512 8 byte receiver (Component)

Postby Jaspervdw » Thu Jul 02, 2009 6:49 am

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)

Postby EPIC » Wed Sep 09, 2009 11:24 am

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)

Postby boogui » Thu Dec 26, 2013 10:52 am

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