LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to control STP-DRV-4850 (Stepper-Drive) in labview

Hello,

 

I am currently working on a senior design project, and I am trying to control a SureStep stepper motor system using LabVIEW.

Pretty much we are trying to control a stepper motor by setting it to 200 steps, and performing a single step at a time so that we can record data. 

 

Specifically I am trying to control a STP-DRV-4850 stepper drive, and a STP-MTRH-23079D stepper motor through a serial (RS232) to USB connector. Links are below. I am able to control the motor/drive using the SureStepPro software and sending commands through a serial terminal.

 

Drive: http://www.automationdirect.com/adc/Shopping/Catalog/Motion_Control/Stepper_Systems/Stepper_Drives_-...

Motor: http://www.automationdirect.com/adc/Shopping/Catalog/Motion_Control/Stepper_Systems/Stepper_Motors_-...

 

There was a previous post that mentioned progamming a stepper drive like the one I am using:

https://forums.ni.com/t5/LabVIEW/how-to-control-automation-direct-stepper-motor-stp-drv-4850-and/td-...

 

I replicated the VI that was pictured in the post, but my drive does not recieve any communications though labview. (I am using an HR, DI200, and FL command) When I added the VISA_CLR block it errored out my drive so I eliminated it, but running it still does not do anything to the drive.

 

Are there any suggestions that anyone could offer me regarding how I could get LabVIEW to successfully send commands to the drive?

(possibly connection/communication issues that I am missing?)

 

Thanks,

Ron V

0 Kudos
Message 1 of 6
(4,634 Views)

Greetings, Ron;

 

When you are running the code that you posted, does nothing happen at all, or do you get some sort of error? 

 

Would you be able to use the Visa Test Panels to see if we are able to communicate with the device without directly using LabVIEW? In addition, while I have not read up too much on the drive yet, can we send it a command such as *IDN to test the communication?

 

Anyhow, let me know if that helps!

 

Cordially;

Simon P.

National Instruments
Applications Engineer
0 Kudos
Message 2 of 6
(4,609 Views)

Hi Simon,

 

When I run my code with the VISA CLR block I get a "communication error" on the drive. When I run my code without the VISA CLR block than nothing happens (no error, no movement.)

 

I have connected and run off of the VISA test panel, and I was able to successfully write and read the (*IDN?\n) off of the drive port.

 

When I send commands to the drive through their SureStepPro software's, serial terminal the commands all write by putting a $ in front of everything, such as $DI200$, $FL$. I tried changing all of my context using the $ but nothing happens still, I've also tried sending the commands through the VISA test panel using all sorts of context combinations to send the commands to the drive, still nothing happens.

 

I wonder if I'm missing something...

 

Thanks,

 

Ron

0 Kudos
Message 3 of 6
(4,594 Views)

For one thing, you dihd not replicate the VI that you have a link to. You are not setting the ASRL End Out. This appends a CR to each write and without a termination character on your writes, the instrument is just ignoring what is sent.

0 Kudos
Message 4 of 6
(4,589 Views)


Do you have a more specific solution that you could recommend to the problem?

 

I am somewhat new at LabVIEW, I've only made simple VI's for a class, and never had to interface with instruments using the serial port with VISA.

 

Also, I have been trying to control the drive using the VISA test panel, and although I can write and read to the drive it is not accepting any of the serial commands that I send it, and still won't work. (DI200, FL)

 

Thanks,

 

-Ron

 

 

0 Kudos
Message 5 of 6
(4,566 Views)

The advanced serial example shows how to configure VISA to automatically send a single termination character - either a carriage return or line feed. The basic example shows how to set the string control/constant to send a carriage return/line feed at the end of each write. The \r\n in the example is the CR\LF and enabling \ Codes is a right click option.

 

You should also check communication with a program such as Hyperterminal, Procomm, Putty, etc. before writing any code. You need to verify that you are using the correct type of serial cable and the com settings are correct. The VISA test panel should work as well if you include the termination characters.

0 Kudos
Message 6 of 6
(4,558 Views)