Hi Andy,
Intermittent results you say :-)
It sits there waiting for a character for 5 seconds, if none is received it goes to mainloop where you spend "considerable" time before you eventually get back the connected subroutine where you again check for an "A". Now, if you happen to send an "A" during the time that HSERIN isn't actually waiting for one it will be missed.
Might be what's happening.
Start by removing all the PAUSE statements you have within your main loop and see if it gets "better". Even so, there will be times where HSERIN isn't executing when you send that "A". An interrupt would be a good option here but you could possibly get away with simply polling the receive buffer, if you stick to sending it a single character.
/Henrik.




Bookmarks