Hi John--
Well, I bought the DMX spec... the current version is now $40. I feel that I understand what's going on there well enough to proceed with trying to translate that into PICBasic.
Problem is, the PICBasic documentation on HSERIN just isn't very complete, and my brain hurts after about 15 minutes of trying to understand the Microchip datasheet... it looks like in PICBasic you enable the receiver by using defines, which don't allow me to turn the port on and off at runtime unless I know what specific register bit I want to change. It looks to me like I turn it on and off by toggling the SPEN bit (RCSTA.7) of the RCSTA register? I don't understand how to clear the RCREG, like you say to do twice... are you saying in your previous post that I don't need to do anything with the CREN bit?
Using PULSIN I did successfully detect the start break, which I then used to generate a PULSOUT on another pin that I put back into my 'scope to use as a trigger. I can see the data as it should look (compared to the USITT data sheet), so at least that part is working. The code I used is:
loop:
pulsin porta.7,0,count0
if count0 >40 then exit '(look for pulse longer than 80uS)
goto loop
exit:
pulsout portb.0, 200
goto loop
Is this similar to what's working for you? (minus the pulsout, of course...)
Also, it occurs to me that according to the spec, if I take more than 4-8 microsecs to determine the pulse length and turn on the USART, I'll miss the header byte... have you been able to implement your DMX receiver using only PICBasic, or do you have some assembly in there too? Do you set the USART to automatically clear its errors or toggle the RCSTA.4 bit?
I'm still feeling kind of fried by all this register settings stuff, but I'm happy I can at least detect the break! (Hey, it's a start...)
Thanks again for your help---
---Alan
Bookmarks