I am trying to send commands to a linear stage motor (locally made) using VISA through the serial port. I use LabView 2010 SP1. I could able to send the first command (move forward) and get the desired output. After each successful execution of the command, the instrument will respond by issuing a code. I should read this command before sending my second command (move backward) to the instrument. I do not know how to do this? How should I wait for the code to send my second command? Kindly provide me some input. I have attached my current VI with this post. Thank you.
Hi pclab,
@pclab wrote:
I have attached my current VI with this post.
No, you did not. All we got is an image of a block diagram…
We cannot edit/debug/run images using LabVIEW!
@pclab wrote:
I could able to send the first command (move forward) and get the desired output. After each successful execution of the command, the instrument will respond by issuing a code. I should read this command before sending my second command (move backward) to the instrument. I do not know how to do this? How should I wait for the code to send my second command?
Did you do the LabVIEW basics training? You should know how to implement loops and (case) conditions!
On your image: it doesn't make sense to close the VISA reference immediately after writing a string into the transmit buffer of the serial port driver!
I have tried to use the while loop. But is it the better way to constantly read data from the instrument till the desired code is issued? Is there a way to wait for the particular code to execute the next command? I have edited the earlier post to include the VI. Apologies.
Hi pclab,
@pclab wrote:
I have tried to use the while loop. But is it the better way to constantly read data from the instrument till the desired code is issued? Is there a way to wait for the particular code to execute the next command?
It all depends on the device you are communicating with!
Usually you send a command and read the response. Then you parse the response and proceed as needed…
Please watch Tim's video on proper serial Communication!