Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Best Practices Question: VISA I/O

Hi All,

I have a best practices question relating to a VISA I/O...

 

I have a microscope I am controlling, and it moves kind of slow.  I was recently doing some characterization to try and figure out how long certain things take, and I came across a weird effect, the time it took to complete any action seemed locked into 500 msec increments, for example, moving the stage 1 mm, 2 mm, or 5 mm all took 1500msec, moving 6 mm took 2000msec.

 

So I did some digging into the driver subVI's (I actually dowloaded them from the Labview website) and I found the reason:

 

After a movement command is sent, the scope responds with a whole big mess of responses, the last of which is "I'm done moving" 

 

So there is a "waiting" subVI that continuously reads the port in a while loop with a 500 msec wait (AH HA!) that runs until the read port command returns an error, and if everything is working, that error is a "time out" error indicating there are no more bytes at the port, then there is some response checking to ensure that the scope is done.

 

So that was a big setup for the following questions:

 

The timeout for the port in the read command is set to 150msec, why run the while loop so slow?  Why enforce the timing in the while loop at all, when you can just let the read subVI (with its 150msec timeout) control the timing of the loop?

 

And the obvious conclusion I draw is that if I want a faster response from my scope, something approaching the time it actually takes to accomplish the requested movement, I should reduce the wait on the loop, and the port timeout and just poll faster.  Obviously there has to be a limit here, how do I determine a good lower limit for the port timeout?

 

Thanks All

Matt

Message 1 of 2
(2,935 Views)

You said that the last respnse is one that says "I'm done moving". The best thing to do is parse the incoming data and stop when you have received that response. Then your timeout can be cut way back to something compatible with the inter-character delay for your baud rate and the response time of the scope controller. That could be as littile as a few msec.

0 Kudos
Message 2 of 2
(2,913 Views)