LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How should I separate my returned string from the device

I ran my program few times. The attached file are the returned strings. When the device is not ready or if the program is ran too soon the device does not read the temperature but days "Pause" or if the thermal couples are not connected it says "RANGE" and also puts a * in front of the channel number. Few returned strings I copy and pasted in the notepad file. Later strings I have two thermal couples connected and the you can read the temperature as 0070. or 0071. and it keeps changing ofcourse. I want to able to separate the the day and time data and then separate the channel data in ascending order and read temperature and display them and plus save them. It would look something like this
for exam
ple for the first string I have in my file.
330 is the day of the year (it changes on the days) 08:40:21 is the time which is ofcourse changing every second. and after spaces I read my channels number display that and then the temperature or if its Pause or ranged then ignor those and read the rest and put the temperature on there corresponding places and next time in loop read the same thing first the day and time and then the channel numbers with their temperature. I would also have to convert that "F and dispaly that also or if its C display that also. Thanks
0 Kudos
Message 1 of 4
(2,777 Views)
You can modify the Extract Numbers.vi in LabVIEW Help under String Examples to seperate the retruned strings. The example vi utilizes Match pattern vi.
0 Kudos
Message 2 of 4
(2,777 Views)
I am receiving the data from a serail port, should I read all the data first and then separate it or I can separate it while I am reading each characters. becasue I know each of my string is what bytes so I can loop it in a way that I am reading 14 bytes and staring after that and read another 14 bytes. What do you think. Thanks
0 Kudos
Message 3 of 4
(2,776 Views)
Hi,

I would suggest reading the whole string first before parsing. I/O is expensive and it is best to transfer as much data in a single shot as possible (DMA vs. Polling is an example). Read the whole string in and then parse. In the end this will both be faster and more elegant.

Best Regards,
Aaron K.
Application Engineer
National Instruments
0 Kudos
Message 4 of 4
(2,777 Views)