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




Bookmarks