Something like -
LoopTop:
If PIR1.5 = 1 THEN ' Check to see if Character was received
HSERIN[Char] ' Grab the character out of the UART
HSEROUT [ADVAL] ' Send the last A/D value
ENDIF
ADCIN 1, ADVAL ' Continuously sample the A/D
GOTO LoopTop
;---------------------------------------------------------------
PIR1.5 will be set (to "1") whenever ANY character has been received
in the USART. HSERIN grabs that character and sets PIR1.5 to "0" at
the same time. Then it sends the A/D value out.
If no character is received, the A/D converter converts merrily along...




Bookmarks