Basic Stamp 2e Parse Serial
jstotler
Posts: 3
in BASIC Stamp
Hey All,
I'm trying to get a basic stamp parse serial data from my surround sound receiver, the receiver sends an entire string of data when it does something. Right now, I'm looking for the basic stamp to read "PWR ON" at the end of the string when the receiver turns on and "STANDBY" when it turns off. I can't for the life of me figure out how to have the basic stamp look for those particular words and respond to it (jump to a particular subroutine). :-(
I'm trying to get a basic stamp parse serial data from my surround sound receiver, the receiver sends an entire string of data when it does something. Right now, I'm looking for the basic stamp to read "PWR ON" at the end of the string when the receiver turns on and "STANDBY" when it turns off. I can't for the life of me figure out how to have the basic stamp look for those particular words and respond to it (jump to a particular subroutine). :-(
Comments
Otherwise, you'll have to read the string into memory, if it's not too long, and parse it there. What else does the string consist of? Is it always the same length?
-Phil
https://google.com/url?q=forums.parallax.com/discussion/164128/select-case-problem&sa=U&ved=0ahUKEwjt-fvwwqTQAhUU-WMKHSukDnoQFggFMAA&client=internal-uds-cse&usg=AFQjCNG3YXh1z0S4A520RGv0we8Fw4JMAQ
The receiver's string is of varying length, for example, when it turns off, the serial sting is simply "PWSTANDBY" when it turns on (the string is below), the line I need the stamp to read is "PWON"
Down the road, I would like to be able to have the stamp adjust the gain on the sub when the sound mode changes between 5.1 and Stereo by reading a few of the other lines (MSDIRECT specifically). As it is now, when Dish inserts their stereo commercials/promos, the subwoofer is too loud and could stand to be turned down a few db.
But, I'm starting slow and want to read the power state of the receiver so I can turn the amp for the sub on and off automatically.
CVFL 51
CVFR 51
CVC 495
CVSW 445
CVSL 52
CVSR 525
CVSBL 535
CVSBR 535
CVSB 50
CVFHL 50
CVFHR 50
MVMAX 98
MSDIRECT
DCAUTO
PSDCO OFF
PSDRC AUTO
PSLFE 00
PSBAS 50
PSTRE 50
PSTONE CTRL OFF
PWON
I'm going to try the code in the link you've provided although, I'm curious how the stamp will respond as the string it sends during POST is sent pretty quickly with carriage returns...
I know I can do this easily with a raspberry pi but, that's CRAZY overkill for this... :-P
-Phil
The question about baud rate is critical. Handling input a byte at a time as it comes in for decoding would be best but need a very slow baud rate or else long pacing between received characters. And at high baud rate, the Stamp simply does not have enough conventional or scratch ram to accommodate the whole long string for processing after the fact.