LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

-1073807339 VISA Read in Serial.vi->GAUSSMETER VI.vi

This a simple prg to get read data frm a gaussmeter. But whenever I run this prg it gives "-1073807339 VISA Read in Serial.vi-GAUSSMETER VI.vi". Although when I use the serial port example in lv 7.0 I dont have any problem in reading the data. When run in continuous mode or under a while loop it gives the same error..Plz help....
0 Kudos
Message 1 of 21
(3,820 Views)

Hi Nostra,

Here is an explanation of the error message:

Warning -1073807339 occurred at an unidentified location

Possible reason(s):

VISA:  (Hex 0xBFFF0015) Timeout expired before operation completed.

 

The vi you attached does not contain the serial.vi which is where the error originates.  Can you attach it?  Or is it the one from earlier versions (ie: LV6.x)?  Because it appears that it does not wait long enough to receive data.  Maybe it should write, wait, then receive..

Try increasing the timeout value (I think it is the 50 that is in your vi). 

JLV

0 Kudos
Message 2 of 21
(3,802 Views)
HI
This is the serial vi i m attaching. I m using the same vi thats there in examples code in lv 7.0. I dont know whether its the same as in 6.x. Plz help...
0 Kudos
Message 3 of 21
(3,798 Views)
Hi JLV
Here s an update. I changes the timeout to 50 but the error is the same. n u r right that there was no time out....regards nostra
0 Kudos
Message 4 of 21
(3,795 Views)
Your attachment didn't make it. How exactly did you do the timeout? Was it a wait statement between the write and read or did you use the VISA Timeout Value property? Your main VI is running every 10 msec. Are you sure that the instrument can respond that fast? Can you run the subVI all by itself and get a result with an error? When you run the subVI by itself, set the String to Write control to '\' Codes Display so that you can easily add the CR (\r) character that is in the main VI. Also, you are sending a CR with each command but the VISA Read is set to terminate when a LF (\n) character is detected. The termination cahracter for reads and writes are usually the same. You should check the instrument's manual to see which one, or both, characters are required. If the instrument does not send exactly 50 bytes or the exact termination character is not detected in the read, the read will issue a timeout error.
0 Kudos
Message 5 of 21
(3,789 Views)
I m sending u the attachment once again. the default value of time out in original lv code is 10 secs. i did both change the time out and the between read write. i changed the main vis running every 50 msec. I m having error on the first execution itself(1st loop). I changes the write to codes display. The default in serial port configure vi is LF. The instrument manual does give wht is the exact byte to read but had an estimate by using *idn? where the whole string is generated for a byte count of 25....if u get the attachment plz tell me where i m wrong. Thanx for helping regards nostra
0 Kudos
Message 6 of 21
(3,779 Views)

First, putting those msec waits in the code they way you've done may or may not work. LabVIEW is a dataflow language. When you have no dataflow, you have no control over execution order. The wait in the write case may happen before the VISA Read happens and the wait in the read case may happen after the VISA Read. You can use a sequence structure (shudder) or use a wait that has error in/error out connections so that you can enforce dataflow. There is the Delay function on the Time & Dialog palette or NI Measurements>Data Acquisition>Counter>Intermediate Counter>Wait+ (ms).

There are a couple of reasons that you will get a VISA timeout. One is if you send the wrong command and there is no data to be read back. Another is if you had the read termination character enabled but the actual termination character sent by the instrument does not match and the number of bytes you requested is too high. In other words, when you enable the termination character, the VISA Read will automatically terminate when the byte count is reached or the termination character is detected. One thing you can do is before doing the VISA Read, put in a wait and then do a VISA Bytes at Serial Port. This will return the actual number of bytes available. You should do this to see whether there is any data at all available. I still think that the problem can be traced to incorrect termination characters on either the read or write. If the VISA Bytes at Serial Port returns zero, then the problem is with the Write termination character.

0 Kudos
Message 7 of 21
(3,773 Views)

Another approach is to place a while loop with a high timeout (ie: 1 sec) that monitors the serial port for any data available. Then proceed with a read.  Or have a while loop that monitors for data and reads until the buffer is empty or until the large timeout occurs.

0 Kudos
Message 8 of 21
(3,768 Views)
Hi guys
Thanx for ur help. Now there is good and a bad news. The good news is that the prg works after using sequence structure. The bad news after using the bytes at serial port vi is that it gives a value of zero. So every time the read data is zero. the string i m using to read data is fine b/c as i told before that the prg works fine when i m using reading only once that is without the while loop. now what might be the problem can u guys tell me.  i m attaching the code again........nostra
Download All
0 Kudos
Message 9 of 21
(3,758 Views)

new error code 85

description

Scan From String (arg 1) in GAUSSMETER%20VI[1].vi

0 Kudos
Message 10 of 21
(3,758 Views)