Hi Darrel--
Right on about the channel, it should say 6. Otherwise, I don't think it's a hardware issue, i.e. resonator vs. crystal... I've been using PBP code (follows) to capture a single channel or two and it works great, but I'd like to get the whole 512 channels, hence trying to adapt AN1075. I think its getting lost somewhere... could this have something to do with BANK0, BANK1, etc?
This is the PBP routine that I have been using to read 2-3 channels at a time; on this same hardware platform it works great...
Code:
'====================================================
' DMX Subroutines
'====================================================
readdmx:
counter = 1
PIE1 = 0 ' Mask the interrupt
pulsin target, 0, counter
idleflag = 0
DMX_OK = 1
if counter = 0 then
idleflag = 1 'either no DMX or break timed out
DMX_OK = 0 'set DMX as not present
goto noshow_exit
endif
if counter < 35 then readDMX 'active pulse too short, keep looking
'otherwise its valid DMX & time to read the start code
dummy = rcreg
dummy = rcreg 'do this twice to clear out ang garbage in the USART
spbrg = 0
txsta.2 = 0 'brgh = 0
txsta.4 = 0
rcsta.7 = 1 'turn on the USART
rcsta.6 = 0 'setting 8 bit receive mode, no parity, etc.
rcsta.4 = 0
rcsta.4 = 1 'toggle the rcsta.4 bit to make-ready
while rcif = 0 : wend 'hover until start code is received
startcode = rcreg 'read the startcode somewhere, tho most likely we'll never look at it
if dmx_channel = 1 then 'if DMX address is 1, do this special case
dummy = rcreg
goto exit_readDMX
endif
'else, do this code for DMX addresses 2-512:
count0 = 0
While count0 < (dmx_channel-1) 'set up loop to count up to just 1 shy of target address
while rcif = 0 : wend 'wait for a byte
dummy = rcreg
count0 = count0 + 1
WEND
exit_readDMX:
DMX_data = rcreg 'put the DMX byte into a variable and exit
noshow_exit:
rcsta.7 = 0 'turn off the USART
if intensity > 0 then
PIE1 = 1 'restore interrupt
else
PIE1 = 0 'if the intensity is >0, let the elapsed timer run
endif
return
Bookmarks