PDA

View Full Version : How to parse a simple ascii string?



DougB
- 18th October 2005, 19:30
I need to take an ascii string from an rs232 port into a 16f84a and
parse the string data. The string data is as follows:

Simple X,Y,T,SN output which returns the X and Y tilt angle in radians and the internal temperature of the sensor :

$ 0.00,16173.42,21.83,N6374
$ 0.00,-16173.42,21.83,N6374

All I need, is the Y value to work with plus the sign of the value in the pic to perform some calculations and supply an output for the sign and an output for the value after calculations as pulses.

i.e.:
'-' sign would provide a low output
'+' sign would provide a hi output

'600' would provide 600 pulses
'1214' would provide 1214 pulses

Any help is appreciated

Doug