LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending sequential commands to a linear stage motor

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.

Download All
0 Kudos
Message 1 of 5
(2,558 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,551 Views)

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.

0 Kudos
Message 3 of 5
(2,547 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,524 Views)

Thank you GerdW!

0 Kudos
Message 5 of 5
(2,482 Views)