Page 1 of 1
RS-232 Incoming Comparison
Posted: Tue Jan 01, 2008 3:35 pm
by Widgetman
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
Posted: Tue Jan 01, 2008 3:49 pm
by Doj
Hello wigetman, this is how I would do it:-
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
Look at the USART module for details of the "waitfor" commands, there is also a string version.
Posted: Tue Jan 01, 2008 8:54 pm
by Widgetman
Hi Doj,
Thanks a bunch. The more I play with this compiler the more I am falling in love. it is so much easier to use than those C compilers out there.
I will play with your example.
Posted: Tue Jan 01, 2008 8:54 pm
by Widgetman
Hi Doj,
Thanks a bunch. The more I play with this compiler the more I am falling in love. it is so much easier to use than those C compilers out there.
I will play with your example.
Posted: Wed Jan 02, 2008 1:25 am
by Doj
let us know how you get on, physically manipulating the ram elements with the end of a pin is easier than using C, in my opinion!