Hi,
In your code you are assuming that the first byte at buffer[0] is the pelco-p header.
Code:
IF BYTECOUNTER=7 AND BUFFER[0]=$A0 AND BUFFER[6]=$AF THEN
GOT=1 'INDICATE THAT THIS IS A NEW PACKET
GOTO MAIN 'RETURN TO MAIN PROGRAM
ELSE
GOTO GETDATA 'GO BACK AND WAIT FOR NEXT PACKET
ENDIF
ENDIF
This might not be the case as you may have a dataset misaligned say for one missed byte or corrupted data. So you actually do not know that if your buffer is perfectly aligned. I think you should consider a better algo for checking the PELCO strings.
I assume are using serout2 for your debug purposes. Why not use the TX part of the USART? Yes limitation are that you need to use the same speed as the RX. DT's INT routines takes a finite time to take action in your PBP routine as it saves all the variables for you and checks all the flags and execution orders (aka all the hardwork that we were supposed to do) but please note that it responds to the interrupt instantly. This may screw up the soft serial out routines of PBP as it will introduce timing jitters in the output serial streams. Hope Darrel can enlighten more.
I wish that I actually find some spare time this weekend to get something useful for you. Hope you succeed before that.
Bookmarks