Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How does VISA serial write work?

I am using LabView 6.0 and the VISA functions to run a distributed sensor network using RS-485 from a NT 4.0 machine.
In order to work properly I have to manually control the RTS line which isn't a problem using the property node.
Here's what I want to know.
I'm using a sequence structure:
I'm writing a command using VISA serial write
Then in the next frame I unassert the RTS.
Now in this setup does Labview pass the command to the serial port and then jump to the next frame in the sequence, or is there some kind of acknowledgment from the serial port that its done so the Write vi knows to finish, or am I running a the risk of cutting off my communication before I've finished or should I put in a short wait after the write to port
, or could this cause me to miss the reply?
0 Kudos
Message 1 of 3
(3,621 Views)
There is no acknowledgement per say on the serial write. What you could do is add it a wait command to ensure that the write gets there before the next frame. This wait does not have to be very long but it may be needed to ensure stable communication. This wait providing it is in the "write" frame should not be an issue when it comes to missing the reply. The data should be sitting on the comm port when you do the read.
0 Kudos
Message 2 of 3
(3,621 Views)
Robert:

With the default settings, VISA Write will not return until the data has been at least posted into the hardware FIFO. To be 100% sure that the data has been transmitted over the wire, you should do these 2 things:
1) Call VISA Flush I/O Buffer with a mask of 32. This will ensure the data has been at least posted into the hardware FIFO, regardless of which settings are being used.
2) Wait a tiny amount of time for the FIFO to be emptied. This is based on the number of bytes in the FIFO and the baud rate. For example, with a 64 byte UART FIFO and 9600 baud, you should wait 67 milliseconds.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
Message 3 of 3
(3,621 Views)