PDA

View Full Version : 4 Chanel Dmx512 ready assembly code to PBP ?



syscoder
- 5th March 2007, 14:34
Hi friends i have found a dmx512 receiver code for 16f628 in another web forum and made some changes on it.
it is 4 chanel dimming code working on 20 MHZ osc. tryed it and working no problem on it
but i want to make same code in PBP can you help me for this ? Assembly Code is here ............

http://members.chello.nl/g.assies/DMX2.pdf

------------------------------------------------------------------------

skimask
- 5th March 2007, 22:10
Hi friends i have found a dmx512 receiver code for 16f628 in another web forum and made some changes on it.
it is 4 chanel dimming code working on 20 MHZ osc. tryed it and working no problem on it
but i want to make same code in PBP can you help me for this ? Assembly Code is here ............

http://members.chello.nl/g.assies/DMX2.pdf

------------------------------------------------------------------------

Sure, I can help you.
How much money do you want to spend on it?
Or you can write some code yourself (again), and we can probably HELP you make it work, instead of make it work for you...

malc-c
- 5th March 2007, 22:10
Firstly, I class myself as a newbie when it comes to PBP... so can't help you out with your question.

However, I think that you are asking a tool order if you want the guys here to convert assembly code to a working PBP program and then help you modify it and adapt it to suit your needs.

Maybe you should / could contact the author of the assembly code and ask them if they could interpret what each line of ASM code does, and then have a go at writing the PBP code and then post that up and ask for assistance if / when it won't work.

syscoder
- 19th March 2007, 22:09
it is ok thanks i have solved it and working now. no problem on it..

syscoder
- 21st March 2007, 10:51
hi friends i search in the forum and found many examples thanks. i have pic 16f876 , 20 mhz osc and 1 led ,i have dmx512 lighting desk too and i want to dimm a led on dmxadres 1 (0-255 to led intensty) but there is some problem on this code it is not working. i found this code in the forum and made it again for my pic but couldnt find the problem.can you look to my code and say what is my problem here?or you can send other example code to receive dmx ..

' PIC 16F876 - 20MHZ OSC

DEFINE OSC 20 ' 20 MHZ OSC
DEFINE HSER_TXSTA 24h ' Enable transmit
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_SPBRG 4 ' 250 000 Baud @ 20MHz, 0.0%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically

ASM
ERRORLEVEL -306, -302
ENDASM

ADCON0 = 0
ADCON1 = 7

counter var word
idleflag var word
dummy var word
RCIF VAR BYTE
startcode var word
aminus var word
adress var word
x var word
level1 var word
adress = 1 ' My Start Adress


checkdmx:
counter = 1 ' Dummy variable
pulsin portC.7,0,counter 'Here looking for the break signal
if counter = 0 then
idleflag = 1 'either no dmx , or break was too long to count
'return
endif
if counter < 40 then checkdmx ' watching for "break"
dummy = RCREG
dummy = RCREG
SPBRG = 0
TXSTA.2 = 0
TXSTA.4 = 0
RCSTA.7 = 1
RCSTA.6 = 0
RCSTA.4 = 0
RCSTA.4 = 1

while RCIF = 0: wend
startcode = RCREG 'firs byte after break
if startcode <> 0 then checkdmx
aminus = adress -1

for x = 1 to aminus
while RCIF = 0: wend
dummy = RCREG
next x

level1 = RCREG
portC.1 = level1 'i want to dimm led on port c.1
RCSTA.7 = 0

goto checkdmx
return

keithdoxey
- 21st March 2007, 12:26
hi friends i search in the forum and found many examples thanks.

You also appear to have MANY POSTS.

Why post the same thing in three threads in the same forum ?????

I didnt read the whole of your code but just this bit is flawed.



level1 = RCREG

So at this point you are reading a lighting level 00-FF (0-255) into a variable called "level1"



portC.1 = level1 'i want to dimm led on port c.1


Now you try to assign a byte size variable to a single BIT of an output port which can only ever be 0 or 1, OFF or ON.

It has been stated several times that you need to create a PWM signal to DIM your LEDs. You need to read up on how to do that. Plenty of examples all over the forum and the wider Internet.

syscoder
- 21st March 2007, 12:45
i looked all of this forum and internet but couldnt find any example for that can you send where is it?
ot if you can help maybe you can writte to me some code

DynamoBen
- 21st March 2007, 14:27
We, the forum, aren't in the habit of writing code for people. You might be able to pay someone to write the code for you.

Please stop posting in multiple locations about this issue

skimask
- 21st March 2007, 15:38
We, the forum, aren't in the habit of writing code for people. You might be able to pay someone to write the code for you.

Please stop posting in multiple locations about this issue

Yep, I'm done with this guy too...

malc-c
- 21st March 2007, 18:19
Syscoder, would you care to run through your code you posted and comment on what it is supposed to do at each section... my guess is that you can't because its's something you have simply copied from someone else, otherwise you would of spotted the flaw Keith has pointed out.

You see this forum isn't a place where you come and ask for someone to provide free of charge the code and schematic for your project. Its a forum where others help you resolve problems with your own code. The guys here are very helpful, but its a two way exchange and you have to put in the effort too, and show that you have an understanding of the basics of what you are trying to do, something which you obviously haven't as you would of understood that any dimming / fading of lights generally requires a PWM output from the PIC.

Maybe if you stopped posting about the same subject in several threads, swatted up on the fundimentals of DMX control, write your own code, breadboard the hardware and then post back here with your code when you have issues, you might get a more welcome responce.

skimask
- 21st March 2007, 23:55
Maybe if you stopped posting about the same subject in several threads, swatted up on the fundimentals of DMX control, write your own code, breadboard the hardware and then post back here with your code when you have issues, you might get a more welcome responce.

Or maybe not! :D