LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

flush buffer?????

You could try using NI Spy (I think it comes with the VISA driver). I've found it helpful to see what the serial port is doing.
0 Kudos
Message 11 of 15
(1,385 Views)

Awakening an old thread here...I'm also currently trying out the "VISA flush" command to try to clear up some serial communication issues.  I saw the suggestion to run "portmon" to monitor the serial port.  Can you run that program at the same time LV is running?

Now and then the device I'm communicating with will lose power, and then reset.  When it resets, for some reason I can no longer communicate with it via the serial port.  I tried using the "VISA flush" command before attempting to reestablish communication but it didn't help.  However I don't really know how to tell what's really going on in the serial buffer to see if I'm using the flush command correctly or not.

Any suggestions?


There needs to be an enumeration time for your device  between each resets and on.If you try to read  the data inbetween them then you will  end up with an error or  worst a crash(Not likely).

Can you  tell us what is the device you are trying to use?
0 Kudos
Message 12 of 15
(1,308 Views)

Man...am I gonna have to offer a month of free gas as incentive on this???


Have you made up your mind on the offer pal?


Message Edited by muks on 08-07-2008 05:12 AM
0 Kudos
Message 13 of 15
(1,307 Views)

It seems to me that when there is a lot of data in the receive buffer, the flush buffer function needs some time to atually empty the buffer. When reading immediately afterwards there are still some old data present. When I perform the "Bytes at port" function I read out zero, and when I then do the Visa receive, I get no old data. My theory is that the "Bytes at port" functions awaits until the flush is finished and then returns 0, and then the buffer is really empty as well. I haven't spent a lot of time testing this, but adding the "Bytes at port" function worked for my application.

0 Kudos
Message 14 of 15
(671 Views)

Very interesting topic to me.

 

Does anyone know how long does it take to remove all data in buffer by VISA flushing?

I would like to know the reliable way to check the point of finishing flush.

"the "Bytes at port" functions awaits until the flush is finished and then returns 0, and then the buffer is really empty as well."

Is it accepted way?

 

As another way, I can read buffers continuously and then waste it until zero byte in the port.

Do you think it is slower than by VISA flush?

 

labmaster.

0 Kudos
Message 15 of 15
(354 Views)