LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I avoid Error 85 in Scan From String scanning VISA read buffer?

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.

0 Kudos
Message 1 of 7
(3,762 Views)

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.

Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 7
(3,758 Views)
I am not sure how to "remember" a string but here is a screenshot of the code, I hope this better explains it.
0 Kudos
Message 3 of 7
(3,751 Views)

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.

Message Edited by andre.buurman@carya on 11-20-2008 10:34 PM
Regards,
André (CLA, CLED)
0 Kudos
Message 4 of 7
(3,743 Views)

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?

Message Edited by YeungJohn on 11-20-2008 03:48 PM
Message Edited by YeungJohn on 11-20-2008 03:49 PM
0 Kudos
Message 5 of 7
(3,738 Views)

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.

0 Kudos
Message 6 of 7
(3,702 Views)

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.

Regards,
André (CLA, CLED)
0 Kudos
Message 7 of 7
(3,679 Views)