[bascom] General serial question, Bascom-8051 V2.08


From "Luke Rainville" <k6lo@i-cafe.net>
Date Mon, 25 Jun 2001 12:05:16 -0700

 
----- Original Message -----
Sent: Monday, June 25, 2001 11:49 AM
Subject: General serial question, Bascom-8051 V2.08

Hi all,
 
I need to monitor a radio receiver serial data line and look for two specific four byte commands, one to turn a specific function on and the other to turn the same function off.  During the time this specific function is on, my device (an audio encoder) will send continuous variable tone telemetery for the purpose of reporting signal strength to a remote location. Normally I just monitor a TTL level in the radio to turn the device on, but this time the need is to look at serial data. 
 
So my question:
 
There will be all sorts of data on the line during the day, but I only am interested in just two commands.  How do I tell my software to react to just those?
 
 
My thinking is like this....
 
Rough example -
 
      dim a as long        'but I know the serial buffer only holds one byte at a time, so this is wrong
 
read_the_serial_data:  
 
       inputbin a
 
            if a = the right four byte command then
 
     goto telemetry
 
 else  don't
 
telemetry:
 
my telemetry code here
 
end
 
Your general wisdom, examples, or references welcome. 
 
Regards and thanks,
 
Luke
 
Saint Helena, CA - USA