Should I also guess that the serial is comming in at 250kbaud?
There are 512 frames, at ~40hz.
A.K.A. ... DMX
.
Should I also guess that the serial is comming in at 250kbaud?
There are 512 frames, at ~40hz.
A.K.A. ... DMX
.
DT
I was going to use 9600n. Thats what everything else uses including the origional boxes my mate made
EDIT: The plan wasnt to use these as DMX lights but how hard would that be? IVe got a DMX controller and i think its faster than anything ive done using the serial port (My DMX box is USB>DMX)
Last edited by The Master; - 27th November 2007 at 08:03.
Hehe. Ive had a quick google of DMX in PBP and it sent me to this thread. BTW, the person who made my origional boxes is electronicsuk (Matt).
After reading that thread im not sure about DMX. I looked at assembler once then quickly made a break for the exit
Very!
Got paid to do it once.
Came up with 1 18F as the front end receiving the DMX.
And any number of slaves (8 per PIC).
Up to 512 channels total. (lots of slaves, kinky)
Unfortunately, it was for LED's (high powered one's, but still LED's)
It'll be harder for A/C dimmers.
.
DT
DMX is out then! I dont want this to be any harder than it already is.
Ive just been reading some of Matt's threads. I can see a few references to the boxes he made for me. Just to add, those boxes are still working perfect after something like 3 or 4 years. Nice job!
Anyways. I cant seem to find much in those threads about the bits im stuck on. There is 1 thing that can be learned from them tho. Dont rivet triacs to anything! I had to replace one once without getting to the solder side of the PCB.
This thread or more specificly the last post is quite interesting. Can someone tell me if the following is correct.
There is a receive flag. Possibly whatever PBP uses as a boolean value. When serial data arrives at the chip this flag is set to true.
RCREG returns the first byte from the serial buffer and removes it from the buffer. If this causes the buffer to be empty (that was the last byte) then the RX flag is set to false.
I take it this uses the hardware UART thing to add data to a buffer (with no code)
Ive just found another thread with sample code of using UART and interrupts. It looks simple enough so im gonna test it out when i get back home (stupid work, ruining my day :P)
Ive had a go at writing some code. This is just for the serial part. The idea is that if the chip gets chr(255) then it sets the next 16 bytes to the brightness levels (Later to be used to control the triacs).
I do have a few questions about it though. Can this only be used on a pin labeled RX? For this chip the pin labeled RX is RC7.Code:datapos var byte newbyte var byte brightness var byte [15] trisc=%11111111 spbrg=129 rcsta=%10010000 datapos=16 loop: if pir1.5=1 then newbyte=rcreg if newbyte=255 then datapos=0 else if datapos!=16 then brightness(datapos)=newbyte datapos=datapos+1 endif endif endif goto loop
An example i have says "RCSTA = %10010000 ' Enable serial port and continuous receive". What are we setting here? Are we telling it which pin is being used or is it just a standard value that means "on"?
Is my code any good or should i scrap it and start again? :P
Ive just tried out Darrel's code again now im on this new chip and it compiled first time without me having to edit anythingI used it to monitor the falling edge and i connected 2 diodes up. I did a quick test...
And the bulb lights up at half brightnessCode:ToggleLED1: pause 5 high PORTd.7 pause 1 low PORTd.7WOO! Im just having a read through "Multiple Software PWM". Then ill have to figure out how to add serial to it but it looks like i can use his code for that too
Bookmarks