Hi,
I was wondering if someone could give me a simple example of how to compare incoming bytes from the USART to constant values stored in memory. I am trying to verify a response from a unit I am talking to over the RS-232 port. Any thoughts or help would be greatly appreciated.
Thanks
RS-232 Incoming Comparison
Moderators: David Barker, Jerry Messina
Hello wigetman, this is how I would do it:-
Look at the USART module for details of the "waitfor" commands, there is also a string version.
Code: Select all
dim result as boolean
dim temp_byte as byte
result=false
temp_byte=EEPROM_value 'you will have to figure out how to read the value out of the EEPROM
result=USART.WaitForTimeout(temp_byte,1000) 'look for return byte value and timeout(1000ms) if failed, result is true if value matches
If result=true Then
'do something
else
'do something else
endif