LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Visa Question-

Hello-

I am trying to use labview to talk with my motion controllers. I have a
command list and when I connect via RS232 using hyperterminal
everything responds fine (the controller takes the command and replies
with the proper response). I have used the VISA Configure Serial port
module to open a connection and then Visa Write to send commands. The
device is taking the commands as it changes the position, however I am
having trouble hearing back from it. Visa Read is not getting a
response. I am running it right after I issue the write command, I
assume there is something I am doing incorrect. Can you offer some
guidance? Thanks in advance-

-Ryan

0 Kudos
Message 1 of 3
(2,617 Views)
Is the VISA timing out or just not returning any data? The default setting for the VISA Configure Serial Port is to enable a termination character for the read. The default term character is a LF and if this is sent before the data, then the read will stop immediately. How are you specifying the number of bytes to read? It is usual to use the VISA Bytes at Serial Port to determine this. If you have this, you might want to single step and see if the number of available bytes is greater than 0. You might not be waiting long enough before doing the read.
Message 2 of 3
(2,605 Views)
In my limited experience, I have had to allow a delay of some sort for the device to generate a response.

There are a few ways to do this:
Simple:
Put a hard wait in a sequence structure and pass error from the write to the read through the structure. This will place a delay between execution of write/read.

Advanced:
Write a read subVI that monitors the "bytes at port" for a number greater than 0. Bytes at port is available via property node. Only continue after this value is greater than one.
I usually read the first byte this way, and continue reading until 25mS has past with a value of 0 for bytes at port before I assume that the instrument is done.
Message 3 of 3
(2,603 Views)