You want to try and figure out if SERIN2 is hanging on the wait qualifier or if it is receiving garbage after the qualifier. You could try something like this:
This will not hang the SERIN2 command on waiting for $66, it's kind of crude and it will not be great if it misses sync (i.e. receives $95 before 66$). To properly do this you want to have what is referred to as a ring buffer (good topic for search).Code:start1: Serin2 PORTB.1,16572,[qual] ' wait for $66, then store data if qual=$66 then start2 goto start1 start2: Serin2 PORTB.1,16572,[recvd] ' once qualifier is recieved store data new data if recvd=$95 then High PORTB.0 ' if recvd=1 turn on LED if recvd=$99 then Low PORTB.0 ' if recvd=2 turn off LED goto start1 ' loop




Bookmarks