https://www.AutomationDirect.com/servos
(VID-SV-0072)
Learn how to talk to a SureServo2 Servo System via Modbus TCP. In this video we use an AutomationDirect BRX PLC to automate communications with the SureServo2 Servo System.
This video assumes you have installed the Modbus TCP com module, it has up-to-date firmware, and you are familiar with how to configure it for Modbus TCP. Check out these videos if you need help with any of those. Our goal in this video is to control a SureServo 2 drive from a PLC via Modbus TCP. I’ll be using this AutomationDirect Do-more BRX PLC for this example. We’ll set up our network addressing like this. I’m choosing these addresses because it uses the SureServo 2 drive’s default addressing which means we won’t have to change any of that. If you are using the drive on an existing network, you will need to change these numbers to work with that network. Again, see this video to learn how to set up the TCP com module to do that. Let’s go to parameter 3.064 and set it to a 1 to reset the TCP Module's IP addressing to those default values. That automatically copies the module's networking configuration to these drive parameters, so we can see them. This is the one time you don’t have to power cycle the drive to get those transferred from the TCP module to the drive. Now we need to get the Do-more PLC on the same subnet and start talking to the drive. But, before we do that, there is one key concept you need to understand before using coms to talk to a drive. When you enter a parameter via the drive's keypad or via the free SureServo 2 Pro software, most parameters get written to non-volatile memory so the next time you start the drive they will still be there. The problem is non-volatile memory has a limited number of write cycles before it fails. That’s typically millions of writes which means it is almost impossible to use up the non-volatile memory from the drive’s keypad or SureServo 2 Pro software. With coms, it’s a different story because you could write a PLC program that hammers the drive with lots of parameter changes every second, which means if you aren’t careful, you could easily use up the non-volatile memory very quickly when using coms to change parameters. So, it’s a really good idea to set parameter 2.030 to a 5. That tells the drive not to store any Modbus commands in non-volatile memory. Of course, that also 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. Ok, enough of that. I set up this drive in position register mode to rotate this disk back and forth. Watch this video to learn how to do that. In that video, we triggered the path from the free SureServo 2 Pro software by entering the starting path here. All that did was enter the path number in parameter 5.007. We could also enable or disable the servo by clicking here which simply wrote a 1 or a -1 to parameter 2.030. Let’s set up the Do-more PLC to do all of that. That is, let’s have the PLC set parameter 2.030 to a 5 to disable retentive writes, a 1 to enable the servo, a -1 to disable the servo, and write a 1 to parameter 5.007 to trigger path 1. Keep in mind that if you are also controlling the servo enable via a digital input, then enabling the servo is an OR function. The servo will be enabled if either the digital input OR the parameter enables the servo. Which also means both have to be disabled to disable the servo. And we should do a read so let’s read the drive’s firmware version in parameter 0.00. To set up the Do-more’s networking just go to the dashboard and click on the ethernet port and change the IP Configuration. I’ve already entered an IP address for this guy to be compatible with the drive’s default addressing. On our first rung, we’ll read the drive's firmware version when C0 goes active. We need to do a Modbus read, using the BRX PLC’s built-in Modbus TCP client which is set up and ready to use out of the box. We want to talk to the drive at its default address of address 192.168.1.10. This needs to be whatever the drive's ID is in parameter 3.0. We haven’t changed it, so I know it’s the default 127. We want to read a holding register. Which one do we want to read? We want to read the firmware version in parameter 0.0, so we go look in the manual, and in the parameter definition, it tells us the Modbus offset is zero and one for each of the two 16-bit registers. So, we add a zero offset to the base address which is 1 and put that here. I should point out that while the Do-more starts its Modbus addressing at 1, some PLCs start at zero. So add the register address to whatever your PLCs base address is. And we want to read both of those 16-bit registers. By the way, every parameter in the SureServo 2 drive is two 16-bit words or two Modbus holding registers wide. I love that because I don’t have to remember which parameters are 1 word wide and which are 2 words wide and have to modify my code accordingly. Having every parameter use 2 words massively simplifies your programming. And we’ll put the result in a single double-wide register D0. Could you put it in two single words starting at say N zero? Sure. And for some instructions, you may want to do that. We’ll put this in a double word. We’ll run this instruction only once on the leading edge of the contact and I’ll add some error bits and an exception response register. That will give us an error code that will help us debug things if something doesn’t work. You can add an end if you want to – the Do-more doesn't require it - accept the changes, and send it to the PLC. I’m assuming you know how to do that. I created a data view and named everything to make it easier to read. The PLC is connected and running, so I’ll just toggle this contact and sure enough, we get the expected firmware version. Perfect. OK, that was reading a register, let’s write some registers so we can control the drive. Again, it’s good practice to set drive parameter 2.030 to a 5 so you don’t use up the non-volatile memory. We don’t really need that for our little demo, but let’s do it anyway just to see how it would be done if we did need it. Let’s use C1 to trigger that. We want to do a Modbus write, to the built-in TCP client, to the drive at address 192.168.1.10. Again, you’ll use your drive's IP address here. The port number is fine, and the drive's default ID is 127 – again, that’s in parameter 3.0. We want to write to parameter 2.030 which the manual tells me is offset by decimal 572, so we add that to this base address and put it here. And remember, while the Do-more starts Modbus addressing at 1, your PLC may start at zero. Again, all SureServo 2 parameters are two words wide and we want to write a 5 to disable the non-volatile memory writes. We’re only running one instruction at a time, so I’ll use the same status bits as general-purpose status bits. Normally you would use separate status bits for each instruction. Enabling the servo uses the same parameter 2.030, so I’m just gonna copy that whole rung, put it here, modify the comment, and use a different C bit to trigger this. The only thing that changes is we want to write a 1 to enable the servo. And I’ll use our general-purpose status bits again. Disabling the servo is identical, so I’ll copy that rung, paste it here, change the comment, trigger it with a different C bit, and send a minus 1 to disable the servo. Finally, we want to trigger the position register mode path I set up in the drive by writing to parameter 5.007. That’s very similar to what we just did, so I’ll copy that rung, paste it here. Change the comment, and use a different C bit to trigger that. This time we want to write to parameter 5.007, which the manual tells me is at an offset of 1294 decimal so we add that to the base address and put it here. We want to start at path 1. And again, I’m going to re-use the same status bits. Accept all of that and write it to the PLC. I gave all the C bits and registers names and created a data view so we can see what is going on. Let’s disable the non-volatile memory writes by toggling this. We don’t really need that for our little demo, we’re just doing it as a reminder. If I reach over and rotate the servo motor, I see it is not currently enabled. So let’s toggle this to enable it and sure enough, I can feel it is now enabled. Let’s trigger the position register mode path I set up in the drive. Yep, the path is now running. And let’s toggle this to disable the servo. Perfect. That ought to be enough to get you started with Modbus TCP communications with the SureServo 2 system. Click here to learn more about SureServo 2 and to find more of these tutorial videos. Click here to be notified when we publish 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