LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Data Communication

I am trying to acquire data from an AHRS unit, but keep getting the timeout error on the read terminal. Does anyone have any solution?

0 Kudos
Message 1 of 2
(2,276 Views)

Search for messages about the timeout error because it will give you plenty of ideas.  You are making several mistakes that people seem to make.

 

1.  Don't open and close the port every iteration of the loop.  Those belong outside the loop.

2.  Do you need to send a termination character with your command?  You have the termination character enabled and set to the line feed character (the default when you don't wire in a value to the connector terminal to the configure subVI).  Generally if a device sends a termination character with its response, it will require one on the command you send.

3.  You don't have a wait between your VISA write and Bytes at Port node.  You need to give the device a chance to respond.  But the bigger deal is point #4.

4.  DON'T USE BYTES AT PORT!  It is the wrong thing to use about 99% of the time.  If your device sends a response with a termination character, then just read a constant large number of bytes.  More than the longest message you expect to receive.  Then you will not need a wait.  It will automatically wait for the response to come in (up to the timeout value you configured) and the read will terminate once it gets the termination character.  It is the most efficient in timing when it comes to serial port communication.

5.  Get rid of unnecessary code constructs such as the case structures with a hard-wired True and the sequence structure.  With proper use of the error wire, things will execute in order.

0 Kudos
Message 2 of 2
(2,262 Views)