Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I use labview 7 to send commands to a stepper motor through serial connection?


I am trying to use labview 7 to send commands to a stepper motor controller linked here:
http://www.acsmotion.com/MCU-2%20Product%20Page.htm

I have software and use this controller on a linux pc all the time, but I need to be able to use it with labview soon because I am working with another lab on a project soon and they use labview.  I was trying to find a way to send commands through a serial cable to this controller.  The controller comes with its own commands such as 3G-30000 to send the motor to 30000 steps etc so I was just looking for an interface in labview to type these commands myself, not necessarily write any software unless it is necessary.  Any suggestions would be appreciated, thanks for the help.
0 Kudos
Message 1 of 9
(4,436 Views)
All LabVIEW drivers can be found on the Instrument Driver Network. Yours isn't listed though. If the vendor doesn't have a driver, then you have a couple of options. There are a couple of shipping examples on serial communication. These should help you get started. There is also the Instrument I/O Assistant. It's not quite as versatile as a driver but if your neeeds are simple, then it will also work. Lastly, you can write your own driver. It's not really all that difficult and there are links on the page above to help you with writing your own.
0 Kudos
Message 2 of 9
(4,426 Views)
I was looking around on that developers page and it seems like there is a lot of programming going on, which is fine if thats what I need to do, but I think there is probably a simpler way of accomplishing what I want.  Basically I want to be able to plug the acs mcu-2 motor controller into a labview computer with a serial cable, and use labview as an interface to just type in a command and have it sent to the motor controller to be executed.  I have tried by opening up Measurement and Automation > devices and interfaces > COM1 and the doing an open visa session.  This seems like the kind of thing I would want, but when I type a command in the write area and execute nothing happens.  Any suggestions on what I'm doing wrong?  Or is the problem that I just need to create a driver and then labview will recognize it?  Or maybe the problem is I'm looking in the wrong place entirely?  Thanks for the help
0 Kudos
Message 3 of 9
(4,397 Views)

You could be sending the wrong command, have the wrong com settings, have the wrong type of serial cable, sending the correct command but in the wrong format, sending the correct command but not the correct termination character, etc. There'sa lot of things that could be wrong with a serial connection. You mention using a program to communicate with it. Is this a program from the vendor or a regular terminal emulation program such as Hyperterminal (or whatever the equivalent is on on Linux box)? If it's a program from the vendor, there could be a lot the program does to format the commands before they are actually sent. Assuming you have a programming manual, I would recomend you first get everything to work with a terminal emulation program. Doing it in MAX should work about the same it's just that if you have problems, it's more likely that the vendor can help explain why a standard program like Hyperterminal does not work.

If you have an electronic copy or a link to the programming manual, someone could also give that a look.

0 Kudos
Message 4 of 9
(4,393 Views)
Here is a link to the manual, I'm hoping the way I linked it works. 

http://mail.google.com/mail/?ui=2&ik=4aa280e055&attid=0.1&disp=vah&view=att&th=116404beba2df00e

I have the paper copy, but the only electronic copy I could get was emailed to me and don't really have anywhere to host it.  The only software on windows I've been trying is labview.  I opened the measurement and automation that came with it, went to the interfaces and devices, com1 and then clicked to open a visa session.  I typed commands such as the ones on page 27 of the manual and clicked execute with nothing happening.  I was wondernig, what you said about a driver, do I need to create one to be able to use the visa session?  Or is the driver only for if I wish to design software?  Thanks for the quick responses, I feel like I'm just overlooking something because all the tutorials I look at make it seem fairly simple.
0 Kudos
Message 5 of 9
(4,385 Views)

First, the link only brings me to gmail. You can attach the document to a post and it will be hosted here. Just click the browse button next to the Attachment box below the message body.

No, you don't have to create a driver. A driver is what you would write with LabVIEW if you chose to do that. Communicating with MAX or Hyperterminal would be enough to test the connection.

0 Kudos
Message 6 of 9
(4,375 Views)
0 Kudos
Message 7 of 9
(4,372 Views)

It looks like the commands are straight ASCII so using MAX should be no problem. In the VISA test panel, when you first open it, it has *IDN?\n as the default. Did you include the \n with your command or replace it with a \r? The \n is a special way to include a LF character and the \r is a way to include a CR character. According to the manual, you need to have a CR at the end of each command. If you haven't, try adding it and see if it makes a difference.

0 Kudos
Message 8 of 9
(4,369 Views)
The \r fixed the problem.  Also, in the revised manual I linked it shows the commands starting with a #, the printed manual I have does not show that, so I think that was causing problems as well.  Thanks a lot for the help, saved me a weeks worth of headaches!
0 Kudos
Message 9 of 9
(4,347 Views)