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

Arduino Uno+Labview 8.5

已解决!
转到解答

Hi,

I am trying to send commands to Arduino Uno using Labview 8.5. Tried the Basic Serial Write and Read.vi setting the baud rate 9600 and rest of the default setting, selected the correct COM port, and wrote the command 

i5000\r\n

This command is to rotate a rotation stage using a stepper motor, by 5 degrees. There is no response.

I can execute this command using NI-MAX and Arduino's terminal and the motor moves.

Could somebody please tell me what am I am doing wrong? I had initially made my own vi using VISA but it didn't work so tried the NI example. Is the example for some reason not applicable to my case?   

There appears no error but the motor doesn't move. 

Thanks a lot..

0 项奖励
1 条消息(共 31 条)
6,187 次查看

Maybe you could show us your VI?

0 项奖励
2 条消息(共 31 条)
6,153 次查看

I would write a very simple echo program for your arduino that simply returns a copy of what it received on the serial port. There must be a difference in what it receiving between the two methods, and this will tell you what that difference is. Only thing I can think of is maybe you are sending the wrong escape sequence at the end of the message, although I don't know what the program is expecting/what the arduino terminal uses.

0 项奖励
3 条消息(共 31 条)
6,134 次查看

@zebraa wrote:

Hi,

I am trying to send commands to Arduino Uno using Labview 8.5. Tried the Basic Serial Write and Read.vi setting the baud rate 9600 and rest of the default setting, selected the correct COM port, and wrote the command 

i5000\r\n

This command is to rotate a rotation stage using a stepper motor, by 5 degrees. There is no response.

I can execute this command using NI-MAX and Arduino's terminal and the motor moves.

Could somebody please tell me what am I am doing wrong? I had initially made my own vi using VISA but it didn't work so tried the NI example. Is the example for some reason not applicable to my case?   

There appears no error but the motor doesn't move. 

Thanks a lot..


Yes, post your VI.

 

You do realize that \r\n are means carriage return and line feed.  I hope you are not sending those characters literally.

 

 

0 项奖励
4 条消息(共 31 条)
6,118 次查看

Thanks for the reply. The screenshots of the example VI with my arduino command are attached. I will try the troubleshooting suggestion and get back asap. Thanks again!

下载全部
0 项奖励
5 条消息(共 31 条)
6,103 次查看

I think nyc has nailed it.

 

Tip: Delete the \r\n from your string, right click the string and select " '\' codes display ", then re-enter the \r\n in the string. These will now be true escape characters and it should work.

0 项奖励
6 条消息(共 31 条)
6,084 次查看

\codes was already selected in the string. Actually in the original VI I had made, I did use these carriage return n newline characters provided in labview as string constants. That vi is also attached. When that didn't work, I tried the example which is in the previous message.

To restate, the same string works in NI-MAX. Return count for the command i5000\r\n was = 7 in both cases : 1)NI-MAX and 2) using the string constants provided by LV as in the VI attached.  

I am still hoping there is something else that's wrong. Any suggestions?

0 项奖励
7 条消息(共 31 条)
6,057 次查看

I have no clue what you are talking about with regards to the carriage return and line feed characters.

 

Repeatedly posting screen captures is a horrible idea.

 

Post your VI.

 

 

0 项奖励
8 条消息(共 31 条)
6,047 次查看

Here is the vi.

Thanks

0 项奖励
9 条消息(共 31 条)
6,042 次查看

In the VI you posted, you are sending a carriage return and line feed with your command.

 

You say that you are able to used NI-MAX's VISA Test Panel to work. You need to see what termination characters, if any, are being sent when you use that applet.

Make your LabVIEW VI match.

0 项奖励
10 条消息(共 31 条)
6,038 次查看