https://www.AutomationDirect.com/servos?utm_source=sx7OJBr-SPo&utm_medium=VideoTeamDescription
(VID-SV-0068)
Learn how to communicate with a SureServo2 Drive via Modbus RTU. In this video we'll use an AutomationDirect CLICK PLC and show you how to setup both the PLC and the Servo Drive for Modbus RTU communications so you can control and monitor the SureServo servo System via your PLC.
Online Support Page: https://community.automationdirect.com/s/?utm_source=sx7OJBr-SPo&utm_medium=VideoTeamDescription
**Please check our website for our most up-to-date product pricing and availability.
We want a CLICK PLC to talk to a Sure Servo2 Drive over Modbus RTU. To do that, we just wire the CLICK’s 485 serial port to the Sure Servo 2 Drive’s RJ45 port like this. I just took an old Ethernet patch cord, cut one end off and for me it turned out to be the blue pair of wires that got me to the correct pins on the drive with the blue white wire being the plus signal. I didn’t connect the ground for our quick little demo. You will probably want to connect the ground for your application. Finally, since this is the only thing on the 485 network, you’ll want to terminate the RS485 wires at the drive with 120 ohms. You can make your own or use this handy port splitter. Put your RJ45 cable in one side and this 120-ohm resistor plug in the other and then plug that into connector CN3 on the drive. The cable is now properly terminated on this end of the 485 network. You could also use that port splitter to daisy chain multiple drives. Normally you will want another 120-ohm resistor here. I didn’t do that for this little demo because the cable is so short. I have this drive setup in position register mode to rotate this disk back and forth. In the position register video we learned that to trigger the path we could use the Free Sure Servo 2 Pro software to simply enter which path we wanted to start with here. And all that did was write that path number to Parameter 5.007. We could also enable and disable the servo by clicking on this guy. All that does is write to parameter 2.030. So let’s do that via Modbus RTU – we’ll enable the servo, trigger the path, and disable the servo. Let’s also read the current firmware version of the drive just to give us something to read via Modbus RTU. That’s at parameter 0.0. In the CLICK software I have already selected and connected to the PLC we are using. Let’s read the Firmware version first. We’ll have the rising edge of contact C1 … RECEIVE … from port 3 which is the 485 port on this PLC … a Modbus command. We need to setup the serial port. Again, we are using the 485 port and Modbus protocol. The Sure Servo2 drive defaults to address 127, so this PLC’s address can be anything else. We’ll leave it at address 1. Normally you would configure the drive to match your RS485 network settings. We don’t have a network setup, so we’ll just make the PLC match the drive’s default settings, which you can find in these parameters. The rest of this stuff is fine for most applications. Great! Our com port is setup. We want to read a register from the drive, and its default address is 127 and since we haven’t changed that, we’ll put that here. You would put whatever your drives address is here. We want to read a register using ModBus protocol. And we want to read the firmware version. In the user manual we see that is Parameter 0.0, it’s located at an offset of 0 and it’s two 16-bit registers. In fact, ALL Sure Servo 2 parameters are 32 bits or two holding registers wide which makes your programming super easy because you don’t have to figure out how many holding registers each parameter uses – every parameter in the Sure Servo 2 drive is 32 bits or two 16 bit holding registers wide. It’s the little things like that, that make working with the Sure Servo System so much easier. The CLICK starts ModBus addressing at this address so we just add the offset to the parameter we want, which is zero in this case, and put that here. We need to put the two 16 bit words into a double word so we’ll put that in DD1. And we’re only reading the one item. I’ll add some status bits, so we can see what’s going on if we need to. And Let’s a comment to remind us what we were doing. Let’s add an END and transfer this to the PLC. I’ll assuming you know how to do that. Let’s bring up a data view and add C1 so we can toggle the firmware version read command and see the result in DD1. The PLC is running so I’ll toggle this and sure enough we get the firmware version from the drive. Which we can compare with parameter 0.00 on the drives keypad. Yep. Same answer. Perfect. Ok, let’s write to the drive. Our plan is enable the servo, trigger a position register path that we already setup in the drive, and disable the servo. So, let’s have the rising edge of C2 … SEND … via port 3 – the RS-485 port on this PLC – using ModBus protocol. And that COM port is already setup from the previous read command so we can skip that. We want to send to the drive at address 127 – again, that’s just the drive’s default address, you would put your drive’s address here. We want to write a single register, using ModBus protocol. We want to write to parameter 2.030 which is at a ModBus off set of 23C hex so we bring up our handy windows calculator, switch it to programmer mode and select hexadecimal and enter that offset. Switch to decimal mode, add the ModBus base address of 400001 and copy that number … and put that here as the ModBus address we want to write to. We want to write a 1, which we will put in DS100. And I’ll create some status bits for that guy … hit OK and add a comment so we can remember what this guy’s doing. Next we want to write to parameter 5.007 to trigger the path. That will be very similar to what we just did so I’ll copy that whole rung and paste it here. Update the comment. Let’s change the contact to C3 and then modify the ModBus write. Everything here is the same except we want to write to parameter 5.007. So we go to the user manual and see that is at this hex address offset. Put that in the windows calculator, switch to decimal and add in the ModBus Base Address. Copy that and put that here so we are writing to parameter 5.007. Let’s send the value in DS101, and I’ll modify the status bits. Turning the servo off is identical to turning it on so I’ll copy that rung and paste it here. Update the comment. Change the toggle bit to C4 and edit the instruction. Everything in here is identical except we want to write a minus 1 which we will put in register DS102 and lets change the status bits here too. We over wrote our End instruction so I’ll add that back in. I’ll compile and transfer to the PLC. I went ahead and added the new elements to our data view and gave everything names to make things easier to read. We need to write a 1 to turn the servo on, a 1 to trigger the position register mode path and a minus one to turn the servo off. The panel switch says the servo is off, and I can verify the servo is not controlling the motor because I can rotate the disk. If I toggle the servo enable bit, sure enough the servo is enabled and holding that position – if I try and turn it, the drive forces it back to position. So the servo is definitely on even though we haven’t thrown the panel switch and there is no real indication on the drive. It’s important to remember that just because this command returned a successful result, it doesn’t mean the servo was actually enabled. If you want to verify the servo is enabled via ModBus, read parameter 0.046. Bit 1 tells you if the servo is active. And there’s a bunch of other things you can check out there too. OK, let’s tell the Position Register mode to start at path 1 by triggering that rung and sure enough the servo drive starts executing the back and forth path I programmed in to it. If we were to read parameter 5.007, we could monitor the status of the path. If the command is in process you get the path it is executing. If the command is complete, then you get the path plus 10,000, if the target position is reached then you get the path plus 20,000. You can also write a 1000 to disable the path. In our demo, we’ll just trigger the SERVO OFF command. We see the position register mode turned off and the motor is no longer being controlled by the drive. There is one thing you need to be aware of. When you issue a ModBus write, it’s just like entering the parameter from the drives keypad – that is, any retentive parameter gets written into the drives EEPROM. The problem is with ModBus you can issue a LOT of commands in a very short period of time which can quickly use up the useful life of the EEPROM. So whenever you use ModBus to control the drive it’s a really good idea to write a 5 to parameter 2.030. That tells the drive not to store any ModBus commands in EEPROM. Of course, that means anything written via ModBus won’t be retentive. If you do want something to be retentive, just write a -5 to Parameter 2.030 to turn this feature off. Write the retentive parameters, and then turn the feature back on by writing a 5 to Parameter 2.030. Now that you see how to read and write SureServo2 drive parameters via ModBus RTU, you now have full access to the drive and can do pretty much anything you would normally do from the Sure Servo2 Pro software or the drive’s keypad. Click here to learn more about the Sure Servo 2 System and to find more videos like this one. Click here to subscribe to our YouTube channel so you will be notified when we publish new videos like this and click here to learn about AutomationDirect’s free award-winning support options.
Voted #1 mid-sized employer in Atlanta
Check out our
job openings