From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wait Command needed on for VISA Read

Hey guys, how's it going?

 

I am currently working with a Mensor CPC 6000 (pressure calibrator). I am using the format Open connection>Write Command>Read bytes at port > Read Buffer, but the problem I am facing is that if I don't place a wait command in between the "VISA Write" and "VISA Read", LabView can't really read the buffer (it will show a random message or an empty string). 

 

The problem with using the wait VI is that I am using multiple of these commands sequentially, and it is starting to take a long time to execute them (wait after wait...), so I wanted to take the wait out. For clarification, the hardware receives the command fine (even without the Wait command), but I just can't read the buffer return. 

 

Is this a known issue to anyone? Is there any solution or will I have to stick with a slow execution?

 

I have attached 2 pictures below, one showing the Wait command (which I can read the buffer) and one without (I cannot read the buffer) so you know what I am talking about. 

 

Thank you. 

Download All
0 Kudos
Message 1 of 7
(2,090 Views)

DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still not enough emphasis)

 

1. Make sure you have the termination character enabled.  If using the VISA Configure Serial Port, it is the default.

2. Remove the wait, clear buffer, and the Bytes At Port.  Just tell the VISA Read to read more data than you expect in a message.  In this case, I would probably use 50.

 

So what this will do is make the VISA Read read data until the termination character is read, ensuring you have a complete message.

For more information, go watch this: VIWeek 2020/Proper way to communicate over serial


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 7
(2,081 Views)

I guess, you'll need wait, but you want to save some milliseconds, instead of fixed 300ms, you can poll for # of bytes in a loop.

 

scofield_0-1595443165869.png

 

On a separate line, don't we want to move the 'VISA Flush I/O Buffer' before sending command to the instrument.

0 Kudos
Message 3 of 7
(2,074 Views)

@scofield wrote:

I guess, you'll need wait, but you want to save some milliseconds, instead of fixed 300ms, you can poll for # of bytes in a loop.

 

 


No No No.

 

With a proper protocol, you'll never need to poll for the number of bytes.

Message 4 of 7
(2,066 Views)

@RavensFan wrote:

@scofield wrote:

I guess, you'll need wait, but you want to save some milliseconds, instead of fixed 300ms, you can poll for # of bytes in a loop.


No No No.


Just because RavensFan did not have enough emphasis...

NO NO NO NO NO NO NO NO!!!

Again, go watch this: VIWeek 2020/Proper way to communicate over serial


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(2,051 Views)

Ugh.  Proper use of VISA read and write and you can have zero extra milliseconds of wait.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 7
(1,997 Views)

What RavensFan, crossrulz, and billko all said. 

0 Kudos
Message 7 of 7
(1,971 Views)