LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino Uno+Labview 8.5

Solved!
Go to solution

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 Kudos
Message 1 of 31
(4,271 Views)

Maybe you could show us your VI?

0 Kudos
Message 2 of 31
(4,237 Views)

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 Kudos
Message 3 of 31
(4,218 Views)

@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 Kudos
Message 4 of 31
(4,202 Views)

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!

Download All
0 Kudos
Message 5 of 31
(4,187 Views)

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 Kudos
Message 6 of 31
(4,168 Views)

\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 Kudos
Message 7 of 31
(4,141 Views)

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 Kudos
Message 8 of 31
(4,131 Views)

Here is the vi.

Thanks

0 Kudos
Message 9 of 31
(4,126 Views)

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 Kudos
Message 10 of 31
(4,122 Views)