LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to abort serial port VISA from wating.

Hello All

How can I abort serial port VISA while wating for a byte to arrive.
Lets say I have timeout set for 3 min. but I want to cancel it before that , how to do it programatically?

I tried to set timeout to 0 while wating for data, and it works, but I do not like this method.

Thanks in advance
Pawel
0 Kudos
Message 1 of 5
(3,263 Views)
Serial Port Break.vi

a better approach is to monitor how many bytes are available at the port "Bytes Available.vi", then read all the bytes. But be aware that if the port is initialized using default settings, the read vi returns when it encounters the first '\n'. Even if there are more bytes available.

Joe Guo
0 Kudos
Message 2 of 5
(3,263 Views)
Hi Joe

I tried it before and it did not work. Maybe I need to checked it again.
Thank you
Pawel
0 Kudos
Message 3 of 5
(3,263 Views)
Hi again

I have made some investigations, and here is what I found:

None of Serial Port Brake nor Set Time out work while the "VISA read" is active. All property node can access VISA class only when the "VISA read" is finished.

Therefore, it looks like there is nothing I can do when VISA is active. The only solution is not to allow VISA read.vi to activate. I think I can use your idea and monitor the amount of bytes at the port.
I wanted to avoid it.
Thank you for your help

Pawel
0 Kudos
Message 4 of 5
(3,263 Views)
The reason for VISA read to be active is becuase it is waiting for a predefined number of bytes to finish. If the data is periodic and slow, it could take long time, upto the timeout value you set.

Joe
0 Kudos
Message 5 of 5
(3,263 Views)