Read from Comm port

Read from Comm port

Postby Jeff Barnes » Thu Oct 02, 2008 12:41 am

Hi Everybody,

I am trying to read some serial data from a comm port and I can't get the data formatted correctly.

If I use hyperterminal to capture the text I get the following:

25-MAY-95 00:38:33 --- --- --- SD
25-MAY-95 00:38:35 --- --- --- SD
25-MAY-95 00:38:37 --- --- --- SD
25-MAY-95 00:38:39 --- --- --- SD


NPB-290 VERSION 1.6.2.0 TREND SpO2 Limit: 85-100% PR Limit: 40-170BPM
TIME %SPO2 BPM PA
11-MAY-95 21:06:11 --- --- ---
11-MAY-95 21:06:13 --- --- ---
11-MAY-95 21:06:15 0 0 ---
11-MAY-95 21:06:17 0 0 ---
11-MAY-95 21:06:19 49 40 136
11-MAY-95 21:06:21 99 80 18
11-MAY-95 21:06:23 99 79 18
12-MAY-95 20:02:56 --- --- ---
12-MAY-95 20:05:16 --- --- ---
12-MAY-95 20:05:18 --- --- ---
12-MAY-95 20:05:20 --- --- ---
12-MAY-95 20:05:22 --- --- ---
12-MAY-95 20:05:24 --- --- ---
12-MAY-95 20:05:26 --- --- ---
12-MAY-95 20:05:28 --- --- ---
12-MAY-95 20:05:30 --- --- ---
12-MAY-95 20:05:32 --- --- ---
12-MAY-95 20:05:34 --- --- ---
12-MAY-95 20:05:36 --- --- ---
12-MAY-95 20:05:38 --- --- ---
12-MAY-95 20:05:40 --- --- ---
12-MAY-95 20:05:42 --- --- ---
12-MAY-95 20:05:44 --- --- ---
NPB-290 VERSION 1.6.2.0 TREND SpO2 Limit: 85-100% PR Limit: 40-170BPM
TIME %SPO2 BPM PA
12-MAY-95 20:05:46 --- --- ---
12-MAY-95 20:05:48 --- --- ---
12-MAY-95 20:05:50 --- --- ---
12-MAY-95 20:05:52 --- --- ---
12-MAY-95 20:05:54 --- --- ---


I would like to take each line and make it a record in a dbf.

When I try to read the comm port the data is all over the place.

Any ideas as to how to correctly read this?
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Detlef Hoefner » Thu Oct 02, 2008 6:48 am

Jeff,

normally your data lines are separated by chr(13).

A solution could be to read characters from the com port into a string until you recognize chr( 13),
then write this string into your dbf, empty this string and continue reading this way.

Hth,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Jeff Barnes » Thu Oct 02, 2008 11:58 am

Thanks Detlef, I will give it a try.
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 77 guests