Collecting and parsing data from a com port

writing data to a file and chanding hex to dec for graphic representat

Page 1 of 1

3 Replies - 1445 Views - Last Post: 22 March 2007 - 09:48 AM Rate Topic: -----

#1 DawgPound  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-March 07

Collecting and parsing data from a com port

Post icon  Posted 22 March 2007 - 06:23 AM

Hi,

My problem that I am having is that I am using wireless sensors to collect and transmit data samples to my computer and I need to manipulate the packet data into graphically representable data. The packets of data that reach my computer are in hex. I can use a terminal program to show me and log the data coming to my computer, which logs it like so:

Terminal log file
Date: 2/21/2007 - 9:47:40 AM
-----------------------------------------------
7E 42 FF FF 00 7D 5D 26 84 01 01 00 C5 00 1E 03
C5 00 1E 03 C4 00 1E 03 C4 00 1E 03 C5 00 1F 03
C5 00 1E 03 C5 00 1F 03 C5 00 1F 03 C5 00 69 D1
7E 7E 42 FF FF 00 7D 5D 26 84 01 01 00 C5 00 1E
03 C5 00 1F 03 C5 00 1F 03 C5 00 1F 03 C5 00 1E
03 C5 00 1F 03 C5 00 1F 03 C4 00 1F 03 C5 00 05
D8 7E 7E 42 FF FF 00 7D 5D 26 84 01 01 00 C5 00
1E 03 C5 00 1E 03 C5 00 1F 03 C5 00 1F 03 C4 00
1F 03 C4 00 1F 03 C5 00 1F 03 C4 00 1E 03 C5 00
51 A9 7E 7E 42 FF FF 00 7D 5D 26 84 01 01 00 C5
00 1F 03 C5 00 1E 03 C4 00 1E 03 C4 00 1E 03 C5
00 1E 03 C4 00 1E 03 C5 00 1F 03 C4 00 1E 03 C5
00 7D 5E 68 7E 7E 42 FF FF 00 7D 5D 26 84 01 01
00 C5 00 1E 03 C5 00 1F 03 C4 00 1F 03 C5 00 1F
03 C5 00 1F 03 C4 00 1F 03 C5 00 1F 03 C5 00 1F
03 C5 00 81 E2 7E 7E 42 FF FF 00 7D 5D 26 84 01
01 00 C5 00 1E 03 C5 00 1E 03 C5 00 1E 03 C5 00
1E 03 C5 00 1E 03 C5 00 1E 03 C5 00 1E 03 C5 00
1E 03 C5 00 93 89 7E
-----------------------------------------------
Date: 2/21/2007 - 9:47:46 AM
End log file

now one packet of information consits of 7E to 7E such as the first packet shown is:

7E 42 FF FF 00 7D 5D 26 84 01 01 00 C5 00 1E 03 C5 00 1E 03 C4 00 1E 03 C4 00 1E 03 C5 00 1F 03 C5 00 1E 03 C5 00 1F 03 C5 00 1F 03 C5 00 69 D1 7E

Of this packet the data that I need to convert and save is from:

01 00 C5 00 1E 03 C5 00 1E 03 C4 00 1E 03 C4 00 1E 03 C5 00 1F 03 C5 00 1E 03 C5 00 1F 03 C5 00 1F 03 C5 00

I also need to know the byte:

01 ....which will either be a 01 or 02 depending upon which sensor this data is coming from.

The packet data that I need to convert is in Little Indian format with two bytes per sample and 17 samples per packet.

Can sombody please show me how to collect the packets coming in through a serial cable, divide the incoming packets into seperate files for each sensor and then how to turn the 18 samples per packet into a decimal number for graphic representation? Any help is much appreciated.

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Collecting and parsing data from a com port

#2 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,898
  • Joined: 25-October 06

Re: Collecting and parsing data from a com port

Posted 22 March 2007 - 06:55 AM

what compiler/operating system are you using?
Was This Post Helpful? 0
  • +
  • -

#3 DawgPound  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-March 07

Re: Collecting and parsing data from a com port

Posted 22 March 2007 - 06:59 AM

View Posthorace, on 22 Mar, 2007 - 06:55 AM, said:

what compiler/operating system are you using?


I am trying to use LabWindows on a windows machine to do this.
Was This Post Helpful? 0
  • +
  • -

#4 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,898
  • Joined: 25-October 06

Re: Collecting and parsing data from a com port

Posted 22 March 2007 - 09:48 AM

View PostDawgPound, on 22 Mar, 2007 - 01:59 PM, said:

View Posthorace, on 22 Mar, 2007 - 06:55 AM, said:

what compiler/operating system are you using?


I am trying to use LabWindows on a windows machine to do this.

I have never used LabWindows but doing a quick web search turned up many links to pages discussing the topic. I suggest you have a look thru the LabWindows manual and see if there are exmples of using serial ports to acquire data.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1