11-20-2008 02:47 PM
I have encountered an Error 85 with my Scan From String VI. I have a timed
loop to read data from a device (flowmeter) using a serial port. This device takes
periodic measurements and sends the reading which contains a numerical value to the serial port COM1. It cannot be read continuously, and the period
between measurements may vary, so I decided a timed loop would be better than a while loop.
The VI begins with VISA Configure Serial Port and then
goes to a VISA Write which sends the message to the device to begin
taking measurements. After this, the device usually says "TAKE FLOWMETER READINGS" to the terminal, thereafter only sending numbers. Then begins my timed loop containing VISA Read. I
am taking the read buffer two places.
First, I am taking it to an Array to Spreadsheet String with the
Format String %.3f, as was in the Write to Text File example. Then I am
using Concatenate Strings with this string and also a string containing
the System Time. This string goes to Write to Text File, which I have
configured using Open/Create/Replace File outside of the loop.
Second, I am taking the read buffer to a waveform chart. I thought
it would be a good idea to use Scan From String to convert the string
into a DBL which I am then sending to the waveform
chart.
I am not sure if the initial "TAKE READINGS" message is giving me an error. I was able to get one reading saved to my text file from the device.
Also the format string for my Scan From String is %.3f
I am getting the Error 85 at the Scan From String only sometimes. When this happens, there is no data being written to the text file. But other times, I get data and it writes to the text file just fine (but rounds to nearest whole number).
Any help would be greatly appreciated! This serial port device has been giving me a lot of trouble.
11-20-2008 03:01 PM
I think you should remember the string received that produces the error and concatenate it to the next received string for it to have a complete value to scan.
To be sure a screenshot of the particular code would help.
11-20-2008 03:22 PM
11-20-2008 03:32 PM - edited 11-20-2008 03:34 PM
The scan function gives back the remainder of the scanned string. This remainder should put into a shift register (once mastered a very powerfull thing) the shift registers output (left side) should be conatenated in front of the string read from the serial port. Initialise the shift register with an empty array.
This is a good example of where to use a producer/consumer architecture.
11-20-2008 03:47 PM - edited 11-20-2008 03:49 PM
Is this what you mean? Did I wire the shift registers correctly?
I didn't know if you meant to Concatenate before Scan From String or Concantenate before or after VISA Read?
11-20-2008 05:23 PM
That looks pretty good on the lower half. It looks like you may want to do something similar on the upper half where you do the writing of data to the file.
In you lower half, you have an unwired tunnel where the string leaves the top of the false case of the case structure. That means in the true case you don't have a wire connecting that tunnel. You will want to run a wire through the true case from your input tunnel to your output tunnel.
11-21-2008 02:53 AM
It is what I meant, but you can use the result in the lower half that is used to fill the waveform graph also for filling the file.