LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need to scan an input string for EOF (control Z) and then view the data that has come in since the last EOF.

I'm talking to a Furness micromanometer.  It sends a string of three lines formatted as follows:
 
Time                 xx:xx:xx xM
Velocity             xxxxx ft/m
Temperature    xxx.x degC
 
I want to watch the input, and when I see the EOF character (ctlZ), I want to display the three lines of text sent since the last EOF.  Any help is appreciated.
 
0 Kudos
Message 1 of 9
(3,920 Views)
Use the Match Pattern function with the EOF character as the search string (input marked "regular expression"). Create a string constant and set it to '\' Codes Display. Then type the Ctl-z into it.

\ Codes allow you to enter the hex value for any character into a string.

Lynn
Message 2 of 9
(3,909 Views)
I'm doing something wrong Lynn; no matter what I enter into the "regualr expression" input, I get "COM 10" at the "before substring" output, and nothing at the "after substring" or the "match substring" outputs.  I'm lost!
0 Kudos
Message 3 of 9
(3,902 Views)
What I want to do is look at the data coming in from theinstrument.  I want to just run a continuous loop to do this.  Then every second, (frequency determined by front panel of Furmess Micromanometer) I want to sense teh EOF character, and view the data, displaying the last three lines of code.  The way I had been doing it, which seems to lead to problems, was to write an upper-case T to the instrument, which queried it.  Then I would read the port to receive the data sent back by the instrument.  There seem to be timing issues which are intermittent, so I looked for an alternative.  Now I want to constantly read the port, and display the data only when there is new data to see.  Am I making sense or am I babbling?  My wife is out of town for 4 days, and trying to keep up with the kids may be taking its toll on my gray matter.
0 Kudos
Message 4 of 9
(3,898 Views)
Can you post a simple VI which shows your problem? Put the example data string into a string control and Make Current Value default before saving the VI (because we will not have your instrument to generate data).

Lynn
0 Kudos
Message 5 of 9
(3,896 Views)
Does the instrument continually send data to the RS232 port or does it only send data when you query it with "T"?
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 9
(3,888 Views)
Lynn, attached is the original vi I wrote months ago.  It works, but occasionally there seems to be a disconnect between the instrument and LabVIEW.  The string received is shown in the upper left corner of the front panel (Micromanometer output) is the string last received.  Then it's parsed out into teh three columns.  AS you can see from the block diagram, I made a rather complex vi, although that was NOT my intent.  Occasionally, as I said, things don't work right.  Instaed of the first line beginning with "Velocity", it might read "city" and then everything is sort of offset, and the data is corrupt.  After closing and reatarting LabView it usually works correctly.  SO, I decided to go with a simpler, less complex approach.  Instead of sending the T to the instrument to trigger it, I simply set the Furness to sample at one second intervals (locally - on its front panel interface)and send its data out on the serial port.  Then I want Labview to monitor the port, and read the data whenever it sees there is date to read.  I don't know if I can use EOF or the start bit, or what.  I just wrote an application like this for another instrument, but I was able to determine the number of bytes in the string (19).  I just used a property node (Bytes at port), compared the numer to 19, and if it was greater than or equal to 19, I read the port. It works great, but I can't seem to get a handle on what I'm doing wrong here.  Anyway, attached is the old vi, as well as the beginning of the new one.  Help??!!!
Download All
0 Kudos
Message 7 of 9
(3,887 Views)
Your Furness vi has a block diagram that is password protected, can't see it.  In your simple vi, put a delay in the loop that reads the serial port.  Without the delay, Labview chews up 100% CPU time and maybe some data would not be processed by the serial port.  Are you sure the EOF character is sent between data chunks?  Read all incoming data, display the data in ASCII or with \codes enabled, and see if you can spot exactly what separates the data chunks or what ends one data block transmission.
- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 9
(3,880 Views)
I found the EOF in the Micromanometer Output in the Furness.vi. The search will find it correctly. I tried using the Spreadsheet String to Array function to separate your data, but because the number of spaces between fields varies, it does not work well.

I suggest reading the serial port continuously (with a delay as tbob mentioned) and parsing the data using the Match Pattern function. The serial port reads might be in a separate parallel loop with the data transferred via a queue or LV2 style global. Simply concatenate the characters read to the existing string in a shift register. Use Match Pattern to remove the segments between EOFs and parse those, possibly by matching the headers (Velocity, Temperature, Time/Date).

Lynn
0 Kudos
Message 9 of 9
(3,875 Views)