ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running a Command in CMD vs LabVIEW System exec

I'm trying to build an API for the Pololu Tic T500 ( https://www.pololu.com/docs/0J71 ) Stepper motor controller and am having an issue getting the system to respond to LabVIEW controls even though it does work on controls issued through the command prompt.

 

For Example: if I 

  1. Open command prompt ( windows, type "cmd," hit "enter")
  2. Type "ticcmd --home fwd"
  3. Hit "enter" 

The system homes to the forward position.

 

cmd.PNG

 

However, when I try to do the same in LabVIEW I get:

lv cmd.PNG

 

but without the motor moving.

 

What is the difference between the two methods, and how do I get the LabVIEW to execute the same as manually entering the value in the command prompt? 

 

0 Kudos
Message 1 of 12
(5,374 Views)

You need quotation marks around the ticcmd argument.  Make your string ticcmd "--home fwd".

 

Bob Schor

 

0 Kudos
Message 2 of 12
(5,352 Views)

Bob rsp.png

 

Tried this, but no luck:

0 Kudos
Message 3 of 12
(5,321 Views)

Use cmd /c. 

aputman
0 Kudos
Message 4 of 12
(5,306 Views)

This might help 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 12
(5,300 Views)

I tried this

cmd c.PNG

 

No dice, I also don't get an output with cmd/c 

0 Kudos
Message 6 of 12
(5,297 Views)

One thing I just noticed is that when I go to Start -> cmd -> Command Prompt I get a window that says "Command Prompt." When I open one with LabVIEW, it looks like I get C:\windows\system32\cmd.exe

 

See below:

command prompt vs c system 32.PNG

0 Kudos
Message 7 of 12
(5,294 Views)

Check the 'standard error' output

0 Kudos
Message 8 of 12
(5,283 Views)

What output do you expect from this command?

 

Try putting the whole command in the command line string (with and without quotes as Bob mentioned).

cmd /c ticcmd --home fwd

 

 

aputman
0 Kudos
Message 9 of 12
(5,278 Views)

Try without the EOL constant. I wouldn’t have thought it was necessary. 

Also, from a quick google it looks like ticcmd adds itself to the system path variable. Try using the path the the ticcmd.exe file rather than just ticcmd. I have never tried relying on system path variables with system exec...not 100% it will work. 

0 Kudos
Message 10 of 12
(5,268 Views)