Communicating with an ACN drive via Modbus RTU is pretty easy, but there are a few things
you need to be aware of.
We’ll use this CLICK PLC as the Modbus Master.
The drive defaults to these com port settings, so we’ll just make the PLC match those.
To set up the CLICK PLC’s com port, we go to Setup, Com port.
We’ll be using the RS-485 port on the CLICK PLC so we click on this button.
We’re using Modbus protocol, and because this PLC is the master, this needs to be a
1.
I’ll change the baud rate to match the drives baud rate and the drive is 8 data bits, no
parity, one stop bit.
This stuff is fine, so I’ll hit OK.
Great, the PLC and Drive’s comports are both using the same settings now.
The PLC is wired to the drive like this.
The ground wire IS important – we’ll explain why in part 2.
On the rising edge .. of C1 … Let’s do a receive.
We want to use that port 3 we just setup.
If you forgot to set it up, you can do it here too.
You would put whatever your drives address is here.
The drive defaults to a 1 and we haven’t changed it, so this is good.
We are going to read multiple registers, starting at what Modbus address?
We’ll, we just go to the Serial Communications Chapter of the user manual and we see this
chart that gives us an overview of the drives memory map.
We could go to the drive parameters and read each one individually, but that’s a waste
of communications bandwidth.
Instead, look at this.
The ACN drives have this drive monitoring area set aside where all the parameters you
would normally want to monitor are gathered together in a read only block of memory.
If I scroll to that section, we see there’s tons and tons of read only parameters all
grouped for easy reading via Modbus.
We’re going to start here at Modbus address offset 784 where we’ll read these eight
consecutive registers.
We just need the offset from this 40,000 number, because back here in the CLICK software, we
see it uses a 400,000 base address.
Which means we want to start reading the slave at address 400,784.
Let’s put the read values into memory locations starting at DS101.
And we are reading 8 total registers.
We could read up to 125 consecutive registers if we wanted to.
I’ll create some status so we can keep an eye on things.
And add the required END instruction.
I’ve already connected to the PLC.
So I’ll write the program to it.
I created a dataview with the read trigger bit and the 8 read values.
Enable monitoring.
The PLC is running, so let’s toggle the Modbus read and see what happens.
The motors not running so everything comes back as zero except the bus voltage.
Exactly what we expect.
Let’s change the frequency to 10 Hz.
Enter to select, Enter to accept.
The drive doesn’t default to keypad control so let’s go to the drive command source
and change it to a zero which tells the drive to use the keypad for run stop control.
Enter to select, enter to accept.
Escape to the top-level frequency display.
Now if I hit RUN on the keypad, we see the drive ramps up to speed.
And if I toggle the C1 bit, we see our current is 2.1 amps, the output frequency is 10 hertz,
etc … OK, we can read any single parameter or group
of parameters we want from the drive simply by looking up the Modbus address in the user
manual.
And we also know that all the parameters we might want to monitor are grouped in this
convenient parameter monitoring address space which makes our Modbus communications much
more efficient.
I’ll press the stop button on the keypad to stop the motor.
Ok, instead of using the keypad to control the drive and set the command frequency, let’s
use Modbus.
First, we need to tell the drive to accept commands via coms and not the keypad.
Go to the drive command source and set it to a 3 to tell the drive to accept run/stop
commands from coms.
Now I can’t run the drive from the keypad.
And let’s go to the frequency source and set it to a 6 to tell it to accept frequency
commands from coms.
Notice that the command frequency isn’t 10 hertz any more.
That’s because the drive is now using the coms frequency source memory location.
We’ll write a frequency value to that via Modus in just a minute.
Over in the CLICK software, let’s have the rising edge .. of C10 .. send .. on port 3
.. a Modbus write.
And again, we already setup that port so we don’t need to do it again.
We want to write to our drive at slave address 1, a single register.
Let’s have this guy write the command frequency.
In the user manual … we see that is at Modbus address offset 896, so in the CLICK software
… we add that to the 400,000-base and put it here.
Let’s put the command frequency value in register DS110.
And I’ll setup the status for this Modbus write.
Add an end and send it to the PLC.
I added the frequency write trigger and frequency value to the data view.
Let’s change the frequency to something we’ll recognize.
There’s two implied decimal points so that’s twelve point three four hertz.
The PLC is running, so I’ll toggle the Modbus write and we see it was successfully sent
and the new frequency appears on the display.
Perfect.
Ok, now let’s control the drive from the PLC.
On the rising edge … of C11 .. we’ll send … on port 3 a Modbus message.
Again, we already setup that com port.
We want to talk to the drive at slave address 1.
We’ll write a single register, to what address?
Back in the user manual we see Modbus offset 898 controls the forward and reverse and can
be used to reset trips and also can set the drive to free spin to a stop.
So we put 400898 here and we’ll put the drive control word in location DS200.
And I’ll add some status.
And add the required END.
I’ll send that to the PLC and update the data view.
Ok, the PLC is running so to tell it to run in the forward direction looks like we need
to set the first two bits, which means we need our drive control word to be a 3.
Toggle the drive control write bit.
The command was successful, and we see the motor ramp up to speed.
Perfect.
To stop the motor, I’ll change the drive control word to zero and re-toggle that command.
And the motor ramps to zero.
That should be enough to get you started with reading and writing to the drive via Modbus-RTU.
But, there are some things you need to know before getting too deep into it, so check
out part 2 where we’ll cover some tips and tricks and fill in a few holes.
Meanwhile, click here to learn more about the ACN family of drives.
Click here to learn about AutomationDirect's free award-winning support options and click
here to subscribe to our YouTube channel so you will be notified when we publish more
automation tutorial videos.