Oh my, look what happened while I was out trying to make a buck, (a.k.a. at work).
That's the most "unless I missed something"'s I've ever seen in a row.
Chris,
You can't jump out of the Interrupt handler back to the main loop.
Instead, you should just use your GOT flag to indicate reception, then let the main loop handle it at it's leisure.I think this might work better for the Main loop ...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 @ INT_RETURN
But, you'll still need to fix the Interrupt handler.Code:MAIN: IF GOT=1 THEN 'IF THE PACKET IS NEW THEN SEND ELSE JUST KEEP LOOPING GOT=0 GOSUB ShowBuffer ENDIF if counter= 5000 THEN 'SEND PELCO VALUE EVERY FEW LOOPS counter=0 GOSUB ShowBuffer toggle portd.1 'LED TO INDICATE TO ME THAT THE LOOP IS LOOPING ENDIF counter=counter+1 goto main '========================================================================== ShowBuffer: serout2 test,BAUD,[HEX BUFFER[0],",",HEX BUFFER[1],",",HEX BUFFER[2], _ ",",HEX BUFFER[3],",",HEX BUFFER[6],10,13] 'JUST CHECK 1ST 2 VALUES return
HTH,





Bookmarks