取消
显示结果 
搜索替代 
您的意思是: 

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.

下载全部
0 项奖励
1 条消息(共 5 条)
2,511 次查看

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 项奖励
2 条消息(共 5 条)
2,504 次查看

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 项奖励
3 条消息(共 5 条)
2,500 次查看

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 项奖励
4 条消息(共 5 条)
2,477 次查看

Thank you GerdW!

0 项奖励
5 条消息(共 5 条)
2,435 次查看