Showing results for 
Search instead for 
Did you mean: 

Stepper motor control with cRIO and RS 485 connection

Go to solution

Hi, I have a Trinamic PD42-4-1140 stepper motor which I am trying to control with my cRIO 9066 using a NI 9871 serial module (RS 485 connection). I have been unable to achieve any control at all so far. I have attached an image of the VI I built, a basic state machine to send different commands to the motor. I am able to compile the VI successfully but the motor does not move at all. I would appreciate any help at all in this regard. Thanks.

0 Kudos
Message 1 of 19

Hey sidpen,


Looking at the manual that I found for your motor, it looks like it uses a 2-wire RS 485 connection, whereas the NI-9871 has RJ-50 pins. What are you using to connect to these?


Have you taken a look at the requirements for the 2-wire configuration?


Pins Used for 2- and 4- Wire Transmission with RS-485


Also, how are you terminating the bus? According to the motor's manual, you can't have floating bus lines.




Alyssa H.

National Instruments

0 Kudos
Message 2 of 19

I used a RJ50 cable to connect the motor to the 9871 module. I wired the motor's RS 485+ to TXD+ and RXD+ on the 9871, and RS 485- to TXD- and RXD-, as suggested in "Pins Used for 2- and 4- Wire Transmission with RS-485".


I know that the manual asks for a 120 ohm resistor, but I thought this was only for multiple devices. I have only the one motor that I am trying to control. Do you think I should add the resistor?




0 Kudos
Message 3 of 19

Can you post some info about the command structure?

Is the checksum calculation correct, does it give any response at all to your commands?

Can you communicate with it from windows with hyperterminal or anything like that?


I took a look at the code but I cant tell anything from it without knowing what the drive expects.



0 Kudos
Message 4 of 19

This is what the firmware manual for the motor says, which is what I have tried in the VI. 

The binary command format for R485 is as follows:

Bytes Meaning
1 Module address
1 Command number
1 Type number
1 Motor or Bank number
4 Value (MSB first!)
1 Checksum

The checksum is correct. I have attached the manual and an image of the front panel. The FPGA led is also flashing so I am sure the VI is executing properly.

0 Kudos
Message 5 of 19

The RTS line might be an issue:


6.3 Using the RS485 Interface
With most RS485 converters that can be attached to the COM port of a PC the data direction is controlled by the RTS pin of the COM port. Please note that this will only work with Windows 2000, Windows XP or Windows NT4, not with Windows 95, Windows 98 or Windows ME (due to a bug in these operating systems). Another problem is that Windows 2000/XP/NT4 switches the direction back to receive too late. To overcome this problem, set the telegram pause time (global parameter #75) of the module to 15 (or more if needed) by issuing an SGP 75, 0, 15 command in direct mode. The parameter will automatically be stored in the configuration EEPROM.

You can change the flow control and tranceiver mode programmatically though a property node.


Worth a look.



0 Kudos
Message 6 of 19

Just to add, yes there is a property node for VISA from PC/RT but there is a property node of the module too on FPGA - its a property of the module if I remember correctly.

I dont have FPGA on this PC but if you cant find it let me know. I will look it up on my machine at work.



0 Kudos
Message 7 of 19

Hi deceased

I assume you are speaking about the properties of the module in the project tree, which I found. I can't find a telegram pause time on there, or any of the other stuff you mentioned. I have attached an image of the properties window as it is currently set.Module properties.JPG

 I am going to attempt changing the Flow control to Software controlled and see what happens.




0 Kudos
Message 8 of 19

I have not been able to achieve motion yet. Does anyone have any inputs?

0 Kudos
Message 9 of 19



Were you able to find the flow control and tranceiver mode using a property node in your LabVIEW code that deceased mentioned? If so, can you post a screenshot of your setup? Or post your code?




Alyssa H.

National Instruments

0 Kudos
Message 10 of 19