05-06-2024 12:17 AM
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.
05-06-2024 02:46 AM - edited 05-06-2024 02:50 AM
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!
05-06-2024 10:55 PM
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.
05-09-2024 10:17 AM
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
05-09-2024 10:20 AM
Thank you