Efficient handling of strings from serial port device? 
Author Message
 Efficient handling of strings from serial port device?

Hi:

I am writing a program that gets data from a remote device by sensing a
single word command. The device responds by sending a set of data for up
to 16 different sensors. I am trying to figure out the best way of
dealing with the data. Typically, the smallest interval will be 1 minute,
so there is plenty of time between readings, and I have a parseString()
routine set up that can handle the individual strings very well.  
However, my 'test' code deals with data in a text file, inputting it one
line at a time (i.e. 'line Input ...') and dealing with it.  So, my Comm
code just take all input until the 'data done' code (in my case, a ">OK")
and dumps it into a file. I think that this will work, but it seems very
clumsy. Is there a better way I should be looking at?

Thanks,

Mike



Fri, 10 Sep 1999 03:00:00 GMT  
 Efficient handling of strings from serial port device?

Hi Mike,
We have developed a program that received msg via a phone
network(motorola). Depending on what you want to
do with the data, we had to read the data into a data base. This had three
tables. One to store the data automatically, then the
operator could move it into a table where the data was acted upon according
to the msg and once finished the data was stored into
a table for later reference.
Hope this helps
Gerhard



Fri, 10 Sep 1999 03:00:00 GMT  
 Efficient handling of strings from serial port device?

:>
:> Hi:
:>
:> I am writing a program that gets data from a remote device by sensing
a
:> single word command. The device responds by sending a set of data for
up
:> to 16 different sensors. I am trying to figure out the best way of
:> dealing with the data. Typically, the smallest interval will be 1
minute,
:> so there is plenty of time between readings, and I have a
parseString()
:> routine set up that can handle the individual strings very well.
:> However, my 'test' code deals with data in a text file, inputting it
one
:> line at a time (i.e. 'line Input ...') and dealing with it.  So, my
Comm
:> code just take all input until the 'data done' code (in my case, a
">OK")
:> and dumps it into a file. I think that this will work, but it seems
very
:> clumsy. Is there a better way I should be looking at?

What do you want to do with this data, other than save it to disk?  If
saving
to disk is all you seek, then your method seems fine to me.  If your
sensors
give you more than just a value via serial, then parse the data
accordingly.

EXAMPLE:

Message from sensor:
"Sensor#1,Temp=88,Status=1,>OK"
or
"1,88,1,>OK"

In the above case, you would parse the info based upon the comma
delimiters.
The raw data may then be written to a sensor specific file based upon
which
sensor has responded.

Open "Sensor1.dat" for.... as ....

(At this point, it might be a good idea to time stamp the reading.)

DataToWrite$ = SerialData$ + ",(" + Time$ + ")"

        Put DataToWrite$,,

Close File#

:>
:> Thanks,
:>
:> Mike



Fri, 10 Sep 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Efficient string handling

2. Talking to external devices via Serial Port (MSCOM.OCX)

3. vb5 &controlling devices via serial ports

4. ActiveX Controls for Serial Devices - Port Contention

5. ActiveX Controls for Serial Devices - Port Contention

6. Serial Port and Device Control Block Help

7. Serial Port error handling

8. Need help in Serial Port handling!

9. HELP: Serial port handling in VB 3.00?

10. script to handle a serial port

11. ocx that handles modem and serial port !!

12. How to handle serial ports hardware interrupts

 

 
Powered by phpBB® Forum Software