07-18-2011 01:27 AM
Hello all,
I would really appreciate if someone could help me to find the difference between VISA Clear and Flush buffer when I use these functions while
communicating over RS-232 between PC and microcontroller. I found that Flush can selectively clear my input and output buffer either by writing to device or by just clearing where as VISA clear will just clear the PC I\O buffers. One more thing I found is VISA Clear takes approxuimately 250 Msecs to perform operation where as Flush buffer takes no time. Am I compromising something when I use Flush buffer ? I would really appreciate if any of you experts could help me to answer this question.
Thanks in Advance,
Manu Mohan
07-18-2011 05:27 AM
Dear Sir!
Where you able to communicate even after you used the 'VISA clear' to clear the buffer, without re-opening the device in Visa configure again ?(just curious).. And u are absolutely right and As its found in the help, VISA Clear for the Serial Instrument flushes (simply discards) the I/O output buffer, sends a break, and then flushes the I/O input buffer... Where as in Flush I/O Buffer we can flush more than one buffer Simultaneously by ORing the masks... And i suppose u wont be compromising anything by Flush I/O...
with regards,
Gokul
07-18-2011 06:16 AM
@goku wrote:
Dear Sir!
Where you able to communicate even after you used the 'VISA clear' to clear the buffer, without re-opening the device in Visa configure again ?(just curious).. And u are absolutely right and As its found in the help, VISA Clear for the Serial Instrument flushes (simply discards) the I/O output buffer, sends a break, and then flushes the I/O input buffer... Where as in Flush I/O Buffer we can flush more than one buffer Simultaneously by ORing the masks... And i suppose u wont be compromising anything by Flush I/O...
with regards,
Gokul
You mean it will break the initialised VISA communication by removing the Assert status with your initialised the COM ? Anyway I'm just using Tx,Rx
and Ground of the COM port, so it is not affecting my initialised communiocation..i.e I don't do any COM Initialise after VISA clear. But I guess it will
affect my communication if I do a PC-PC communication and I have to re-initialize the COM, Please correct me if I am wrong.
07-18-2011 06:38 AM
Yes sir! you are absolutely right... I would recommend using Flush I/O buffer function if you would like to maintain the communication with the device even after flushing the buffer... 🙂 To my knowledge and observation Visa Clear was used only when the buffer needs to be cleared and the Port needs to be released from Labview, for some other application to use the port for communication...
With regards,
Gokul
07-18-2011 06:43 AM
@goku wrote:
Yes sir! you are absolutely right... I would recommend using Flush I/O buffer function if you would like to maintain the communication with the device even after flushing the buffer... 🙂 To my knowledge and observation Visa Clear was used only when the buffer needs to be cleared and the Port needs to be released from Labview, for some other application to use the port for communication...
With regards,
Gokul
Then how would VISA Clear and VISA Close differs ?
07-19-2011 10:28 PM
VISA Clear just clears the input and output buffers of the device, but VISA Close closes the device session. VISA Clear woould not close the device session, and VISA Close would not clear the buffers.
Regards,
Sahil Singla
Applications Engineer
National Instruments
08-30-2011 10:28 AM
Hi All,
I just searched ni.com and found this post. I was trying to find out if a VISA Close Function followed by a VISA Configure Serial Port vi function on the same serial port flushes the VISA I/O buffer or not. Sahil says, "VISA Close would not clear the buffers" but I would think that the VISA Configure Serial Port, which opens the port, would flush the buffers.
Does anyone know if this is true? Also, where can I find this in NI.com documentation? I cannot find any mention of this specifically.
Thank you very much.
Ed
01-30-2013 04:37 PM
From what I am doing right now, Visa configure port does not clear the buffer say if the device is still communicating with the computer after your program has closed without closing the communications. I'm not sure if the communication is closed (not just stoping the program or force quiting the program) if the buffer is cleared.
to get rid of data once the port has been configured and the communication has started read the number of bytes at port with a property node and if not 0 then flush the buffer. Otherwise there may be sync issues, i just found this out.
01-31-2013 11:33 AM
Manu,
I have only ever needed to use the VISA Flush I/O Buffer vi, and I've only ever needed to use the default mask of 16 to clear the input buffer on the PC. That can happen on occasion if unrequested data arrives at the serial port from my external instrument. Therefore, when I start a new acquisition sequence, I simply flush the input buffer to clear it.
As previous posts said, the VISA Clear generates a BREAK, which is about 250 mSec long, as you observe. Generally you don't need or want that. (To repeat from the Help: VISA Clear "flushes (discards) the I/O output buffer, sends a break, and then flushes the I/O input buffer.")
Since your PC LabVIEW program is in control, you know when you are sending, so you shouldn't need to clear the output buffer. (However, in a complex event-driven program this may not be so clear.) What you may not have control over is when and how much data your external serial device sends. My device will only sends upon request from the PC or from a user-initiated transmission.
Hope this helps.
Ed
10-14-2021 11:09 AM
I would like to ask about this third party driver I plan to use. As you can see after VISA Open
we have VISA Clear
and then, after configuration, we have VISA Flush I/O Buffer
with mask 0x40
OR
0x80
and VISA Set I/O Buffer Size
with mask 0x30
(which is not mentioned in help file).
Is VISA Flush I/O Buffer
redundant here and could be removed? Or maybe there should be used VISA Flush I/O Buffer
at the beginning instead of VISA Clear
?
What is the purpose of VISA Set I/O Buffer Size
at the end? Is this a common practice to set it during serial communication configuration? How to interpret 0x30
mask?