LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa Write very slow. Using Hyerterminal everything is fine.

Solved!
Go to solution

Hi,

 

I am new to Labview. As a first test I am trying to read data from a piece of custom measurement equipment. By sending a command like e.g. "Sample 10" plus a line feed (Ascii 10) the device will return integer values at a rate of 10 Hz (each followed by a line feed character (Ascii 10)).

 

Using labview the first command that is send to the measurement equipment will take like 5 seconds to send. In hyperterminal the same thing takes no noticable amount of time.

 

To me it is even more strange that while the measurement device transmits new data Labview can send out a new command immediately (just like in hyperterminal...). But once the device stopped sending every new command would take again like 5 seconds to process/transmit.

 

Up to now I've tried to send commands byte by byte without success. In addition I played with the timeout of Visa serial and also the terminal characters without any success. 

 

Any ideas?

 

PS: I attached the code using a png (hopefully this is including the code).

PSS: Kind of nice write to something in English again. Reminds me of my exchange to the US as a student and the wonderful summer in Rhode Island...

 

Download All
0 Kudos
Message 1 of 3
(940 Views)
Solution
Accepted by ArthurPauken

Hi Arthur,

 


@ArthurPauken wrote:

To me it is even more strange that while the measurement device transmits new data Labview can send out a new command immediately (just like in hyperterminal...). But once the device stopped sending every new command would take again like 5 seconds to process/transmit.

 

Up to now I've tried to send commands byte by byte without success. In addition I played with the timeout of Visa serial and also the terminal characters without any success. 

 

Any ideas?


From your description I guess that TimeOut is the problem: when the device stops sending new data you still try to read them. The VISARead will wait for the TimeOut before giving up and so your loop will also wait for the next iteration…

 

Try to set a smaller TimeOut value!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(925 Views)

It looks to me as though you did the "hard part" correctly (namely using the default VISA configuration using LF as a termination character, then scheduling a VISA read specifying more bytes than you expect (I typically specify 1024 or 1000, but the 100 you specified might be adequate ...).

 

However, I question the rest of the logic.  You have VISA configured -- what do you want to do next?  You want to wait for the User to press "Transmit command".  When this happens, what do you want to do?  You want to immediately start reading from your VISA device "until everything has been read", at which point, you quit.

 

Since you are "new to LabVIEW", you might not have learned about Event Structures running in a parallel loop to detect Boolean Button presses.  But you can also do this with a Serial loop.  Configure VISA.  Create a While Loop and run the Error Line through it, and put a 100 ms Time Delay in there (this is a "Do nothing but wait" loop, but why burn up CPU cycles?).  Wire "Transmit" to the Stop button.  Put the VISA Write Command on the Error Line after the Error Line comes out of the "Wait".  One more While Loop (which doesn't need, or want, a Read control) to do the Reads from your VISA device and do whatever processing you want to do.  This Loop might not want/need a Time Delay, depending on how much time you need to spend processing the data, and how fast it comes in.

 

But how do you get out of this final "Read" Loop?  Several possibilities suggest themselves.  If you know how much data to expect, you could simply count the loops and exit when it finishes.  If you know that once data starts coming in, you should see new data at a rate of 10 Hz (or 0.01 seconds between reads), you could set the VISA Read Timeout to, say, 1 second, and exit if the VISA Read "times out".  

 

Bob Schor

0 Kudos
Message 3 of 3
(856 Views)