Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

visa read write problem

I am rotating an antenna using rot 1 prog, I am using qmh to do it. To send commands to controller I am using visa, I am creating a program, in which i send start rotation from 0 to 180, then i send the qmh to go to read status of angle and give me angle in real time. But this does not work, so i introduced delays, it work some times but is mostly buggy.

 

Start command.JPG

Get angle.JPG

0 Kudos
Message 1 of 5
(161 Views)

Please view and study this movie: https://labviewwiki.org/wiki/VIWeek_2020/Proper_way_to_communicate_over_serial

Most problems with serial communication in LabVIEW can be solved with the information in that presentation.

 

A few points right away from a 5 second glance at your diagram:

 

1) What is the display style of your string constant for the VISA Write function?

2) In 99.99% of the cases, the use of the Bytes at Serial Port property node is simply outright wrong! It does not work the way you and most other programmers wish it to work. That 0.01% where it is justified, most LabVIEW programmers will never encounter and if they do, they are extremely likely to never get a reliably working device communication!

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 5
(135 Views)

The constant I used in the write command, here in image I uploaded is to tell the controller to rotate the antenna by 180 degree. The format is given in the manual. These commands work fine till I give get angle command with rotation command. Their is also some kind of minimum delay I have to give to angle subvi and rotation program otherwise it does not work at all. 

0 Kudos
Message 3 of 5
(99 Views)

Your wait command isn't adding a delay in between the write and the read.  Think dataflow, that timer can execute a 400ms delay in before, in parallel or after your write and read commands.  So it is not effectively adding any delay to your read request and that read is happening right after the write commands and  while your rotation is still in progress (and there are zero bytes at port).

 

A few options.

- follow the advice on serial instruments and not relying on bytes at port.

- add the delay inline with https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/vi-lib/express/express-execution-control/t...

- set the instrument timeout appropriate for the length of time the move takes

- if the device sends out a finished the move response, then try poling in a loop with a short timeout 

 

Hope that helps,

Criag

 

0 Kudos
Message 4 of 5
(69 Views)

Thank you 

0 Kudos
Message 5 of 5
(67 Views)