LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does Visa have any buffer/memory or similar?

Yes, the idea is to to something to stop the transmission when the VI application is stopped but I don't know how, because how can I do that when I press the stop button, the port closes? And how to discard data that is in the port? The best thing would be that the port wouldn't store data, is it possible to do that? Where does data store?
Message 11 of 48
(1,662 Views)

CarlosSp wrote:
Yes, the idea is to to something to stop the transmission when the VI application is stopped but I don't know how, because how can I do that when I press the stop button, the port closes? And how to discard data that is in the port? The best thing would be that the port wouldn't store data, is it possible to do that? Where does data store?

 

I already told you how to get rid of the data, check how much garbage is there (num bytes at port) and toss it (read it and throw it away).

 

The OS maintains a port for the data.

 

I do not know if there is a way to tel the OS not to use that port after you close the VISA sesion.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 12 of 48
(1,661 Views)

Ben's suggestion will work also (although it leaves residue in the buffer), and it is easier to implement while not requiring an extra dependency at either end (PC's).

 

Kudos to you, Ben.  (I can't give any from this location).

 

R

Message 13 of 48
(1,648 Views)
I don't understand what do you mean by reading port and toss the data, because in fact is what I do, the problem is that it shows the frames that were accumulated very quickly, it only takes few seconds untill stabilizes. That doesn't bother me, it's just that I don't know why, the application sends a strange frame via RS232 and the other application that receives it goes down. So I understood that I had to read the port and throw data away? The fact is that the application is continously reciving data.
0 Kudos
Message 14 of 48
(1,635 Views)

Just check the number of bytes at the port upon initializing the port.  If there is any data (not equal to zero), then read it. 

Don't even bother wiring the read buffer.  See image below:

 

Message Edited by Ray.R on 03-16-2009 07:38 PM
Message 15 of 48
(1,624 Views)

Thanks a lot Ray, I'll try to put that on the port configuration. By the way, in the other read (the good one) I have a "10000000" in the bytes pad, that number doesn't matter isn't it?

 

 

0 Kudos
Message 16 of 48
(1,613 Views)
I have tried that and it's worse than the solution I had. It reads quicker than after, but the problem is when I stop the application for a while and run it again. My VI program doesn't have problem, but yes the other application of Visual Basic I have in an embbeded PC that receives a strange frame from my VI one and goes down.
0 Kudos
Message 17 of 48
(1,610 Views)

You should not wire 1000000 as the number of bytes to read, because that will force the VISA Read to wait until there are that many bytes or to timeout, which is usually up to 10 sec depending on how you set your timeout value.

 

The portion of code that appears after the configure port...  You can use the same code and put it in the while loop that runs during the communication transactions.  At the end (outside the while loop), read the port one more time just before closing it.  By implementing this, your LabVIEW portion of the code should be more stable.  You may then need to look at the VB portion of the code to do something similar.  The idea is to try to have a relatively clean buffer at both ends to avoid having bizzare characters when re-starting the application.

 

R

Message 18 of 48
(1,593 Views)

Thanks Ray, then what I have to put in the "byte count" pad in read's command? Because bytes change depending of the data transmited.

 

I found a command that is perfect for read and  toss data, it's the "flush buffer", I have to put it as you say, to purge the port when I want to stop the communication or restart it.

 

By the way, how do I change the waiting time of VISA read?

0 Kudos
Message 19 of 48
(1,576 Views)

As I mentionned in my previous post, you need to put the following inside the while loop that takes care of the communication:

 

property node for the number of bytes available at the port.

case structure that contains:

   a) value 1 (default) : the VISA serial read wired with the serial data output (leaving the case structure)

   b) value 0 :  wire through the VISA reference, error cluster and wire an empty string constant to the tunnel for the serial data output

 

What I described above in shown in the image I posted..  The only difference from the image way above and what should be in your while loop is to remove the configure serial port which appears at the left of the image.  The property node "Bytes at Port" will give you the number of bytes to read.  That is what would replace your byte count.

 

R

Message Edited by Ray.R on 03-18-2009 12:55 PM
0 Kudos
Message 20 of 48
(1,568 Views)