LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the response available 3s later after issue command on the COM port (to solve the Error -1073807339) ?

Hello Everyone!

 

I am communicating with a device through COM port. That device response (1 byte to read) to command right away (<0.5s?) for all of the commands except one. That special command will take 3s to execute on the device then generate response back on the COM port. So when I use "VISA read" it error -1073807339 Timeout expired before operation complete. 

 

I added 5s wait after send the command and before reading the response, but still same error.

I tried pause 5s after send the command then read the response, but still same error.

 

So how to code to get the response of this special command? Thank you!

 

BigDrum_0-1734419714477.png

 

0 Kudos
Message 1 of 10
(179 Views)

What device are you trying to talk with? Could you share more of your code that shows the full communication scheme you are using?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(146 Views)

So, are you sure there is an answer after 3 seconds? How did you prove it?

Did you set a terminator? If so, this would cause problems with a 1-byte response.

To debug your problem, this time it is useful to make a loop (with a small wait timeout) with a bytes-at-port node, to control whether there is a response at all.

 

Greets, Dave
0 Kudos
Message 3 of 10
(133 Views)

I would have to agree with crossrulz here, more information is needed on your device and its communication protocol.

 

NI-VISA timeout defaults to 2 seconds (2000mS) have you tried increasing that to 3 or 4 seconds?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 10
(114 Views)

The device is a communication module with ASIC. I am just using the common VISA vi from NI. The problem is all of the other commands work fine except this one which take 3s to response on the COM. 

BigDrum_0-1734494331311.png

 

0 Kudos
Message 5 of 10
(96 Views)

Yes, I had used RealTerm to send the command and watch the response.

 

No, I did not set a terminator.

 

Yes, I can use Bytes at Port node to debug, thank you !

 

 

 

0 Kudos
Message 6 of 10
(94 Views)

Yes, I can set the timeout = 4s like below. Thank you !

 

BigDrum_0-1734494825607.png

 

Message 7 of 10
(92 Views)

I'd do it like this to preserve the original timeout value:

 

billko_0-1734503991220.png

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 8 of 10
(79 Views)

@RTSLVU wrote:

NI-VISA timeout defaults to 2 seconds (2000mS) have you tried increasing that to 3 or 4 seconds?


If using the VISA Configure Serial Port, the default is 10 seconds.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 10
(57 Views)

@BigDrum wrote:

Yes, I had used RealTerm to send the command and watch the response.

 

No, I did not set a terminator.


My guess is that you are not sending the termination character with this command, so the ASIC does not know the command has been fully transmitted.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 10
(55 Views)