Need to read ASCII data, then throw relay - complete noobie!
Hello all!
I'm a complete noobie. I don't even own a board or programmer, yet. But, I thought I'd write this in hopes to get a feeler out there for hardware recommendation and a simple structure on how to perform a task.
I have a constant, repeating ASCII serial stream representing values that I need to parse. Based on one value, I'd like to trip a relay.
For example, the output would look like this: A=23 BX=19 GRT=20.
Can anyone recommend hardware I should acquire? I'd like to trip a relay, say if GRT=22.
I understand that I'd need to set a pin high and then sense that pin to trip the relay. That part isn't an issue, but I'm not sure how to parse the ASCII stream?
I have had a programming background, but it's been twenty-some years! (Assembly code on Commodore 64!!)
Any response is appreciated.
I'm a complete noobie. I don't even own a board or programmer, yet. But, I thought I'd write this in hopes to get a feeler out there for hardware recommendation and a simple structure on how to perform a task.
I have a constant, repeating ASCII serial stream representing values that I need to parse. Based on one value, I'd like to trip a relay.
For example, the output would look like this: A=23 BX=19 GRT=20.
Can anyone recommend hardware I should acquire? I'd like to trip a relay, say if GRT=22.
I understand that I'd need to set a pin high and then sense that pin to trip the relay. That part isn't an issue, but I'm not sure how to parse the ASCII stream?
I have had a programming background, but it's been twenty-some years! (Assembly code on Commodore 64!!)

Any response is appreciated.
Comments
The Stamp's SERIN statement has a feature where it will wait for a specific string (like "GRT=") before proceeding. This string can be followed by an ASCII decimal number which is converted to a numeric value which you can then test further using other statements. Download and look at the "BASIC Stamp Syntax and Reference Manual" and the "What's a Microcontroller?" tutorial for descriptions and examples.
The Nuts and Volts Column #6 shows how to use a transistor with a Stamp to control a relay. The same general idea applies to a Propeller.
If your Baud is much above 9600, you'll have to use a Propeller. This is normally programmed in Spin. There are library routines (called "objects") available in the Propeller Object Exchange and several of them will do buffered high speed serial I/O. One is a library of routines that provides Stamp-like functionality including a "wait for a string" routine and a "convert an ASCII number to a numeric value" routine.
I've been shoved in the right direction... Thanks!
Note: Even though the BS2 is supposed to work fine at 9600 Baud and will transmit as high as 19200 Baud, it's kind of marginal at 9600 Baud for complex functions like a SERIN WAIT("GRT=") followed by a DEC prefix (for converting from ASCII to numeric). It makes a big difference to have 1.5 or 2 stop bits on your serial data stream characters. That gives a little more time for the Stamp to do its processing. The BS2px is much faster and will work up to 19200 Baud.
Correct me if I'm mistaken, but I believe that feature is NOT available for the BS1, regardless of the baud rate used.