LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Half duplex problem - missing ACKs from slave.

Hi,

I'm returning to Labview after a bit of a hiatus... please  be gentle...

 

I am communicating over a COM port. My software sends a command, the slave responds with a single byte ACK (06) or a NAK. On receipt of the response, my software completes the transaction. 

 

This works fine with our older products.

 

Newer products respond much more rapidly, and my code misses the ACK. It retries a couple of times, then the VISA errors with a non-specific error. This happens on 30% to 50% of transactions, sometimes every other attempt fails. Then I have to reboot to clear the port. 

 

My code is based on a fairly generic VISA serial example. It polls the Bytes at Port property to see if a response is available, then reads the port (for one or two commands, the response can take several seconds but most return immediately). 

 

The port is 9600 8N1 half duplex, no handshake. The hardware uses a USB to RS485 device, and it works perfectly with other software, no retries are requested, so it doesn't look like a hardware issue. The PC is a modern Dell system. 

 

The TX and RX LEDS flash, so I know the slave is responding. 

 

Can anyone suggest why I'm missing the response, or how to read the port more quickly?

 

Thanks

Malcolm

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

I hate the VISA example because of the use of "Bytes at Port".

Do not use Bytes at Port. Send your command then do a VISA Read for the 1 byte Ack or Nak with a correct time out value. 

 

Does your slave echo the command you sent? If so you will need to read in the echo before you will receive the Ack or Nak.

Set the byte to read correctly based on the command you sent.

 

No need for Bytes at Port. Just VISA Write followed by a VISA Read with correct timeout and bytes to read.

 

I do not leave the VISA timeout set to default, but will adjust it on the fly as needed.

 

In case I missed to point out, I never use "Bytes at Port"

Omar
0 Kudos
Message 2 of 2
(2,664 Views)