Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I check that all data has been written before writing additional data?

Hi, I'm trying to operate different devices using VISA.  I receive data at around 200 Hz from one device which governs the speed of my overall control loop, while I want to send commands to a slower device as fast as possible.  My idea is to have the loop check the size of the output buffer and only issue commands when there is nothing left in the buffer.  Basically, I want to make sure all the data has been written before it sends another command.  If anyone knows how to do this, or has an alternate method, I would greatly appreciate it!
 
 
0 Kudos
Message 1 of 2
(3,040 Views)

Hi rryckman,

If you are using LabVIEW, you can use the "Number of Bytes at Serial Port" property node to get the number of bytes currently at the port.  You can then have a part of your program test whether or not this number is 0 and proceed with the program accordingly.  I have attached a picture with 2 examples on using this.  This property node is also used in the example called "Basic Serial Write and Read.vi", which is located in the Hardware Input and Output folder of your Example Finder in LabVIEW.

I hope this helps, but let me know if you still need assistance!

Chris R.
Applications Engineer
National Instruments

Message Edited by Chris_R. on 04-03-2006 07:59 PM

Chris R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,016 Views)