LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time out function in VISA configure serial port vi

I have some doubts regarding the time out functionality of "VISA configure serial port vi":

 

1) I have set the time out value as 10s while initializing the port using this vi. Does this mean that for any Rx operation happening on the serial port, it will wait for 10s for the data to be received?

 

2) Is this waiting functionality also valid on "bytes at port" vi which I am using before reading the port data?

 

Because in my application, the control at serial port is actually not waiting for 10s and is coming out before the desired time out (10s). Do I need to set this time out anywhere else apart from initialization at "VISA configure serial port vi"??

 

Can anyone please tell the steps to set this timeout for the serial port?

 

Thanks in advance!

0 Kudos
Message 1 of 3
(2,988 Views)

Hi mnx,

 

1) No.

VISARead will return when a) the requested number of bytes is received, b) a TermChar is received (if enabled), or c) the timeout occurs before the requested number of bytes could be read.

 

2) No.

 

You only need to set timeout at SerialPortInit…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,979 Views)

1. A read will return when the first of the following is satisfied:

   a. The number of bytes at byte count has been received.

   b. The termination character (if enabled) has been received.

   c. An error is detected.

   d. The timeout time has elapsed.

 

I am not sure what happens if handshaking is enabled and the other device pauses communication.

 

2. No. Bytes at port returns immediately. This is a status check and it would not make sense for a timeout to apply.

 

Without seeing your code and the data the remote device is sending, we can only guess. My first guess would be that you have termination characters enabled (default) and a termination character appears in your data.

 

Lynn

0 Kudos
Message 3 of 3
(2,971 Views)