In this video we’ll walk through this ladder code example in the examples folder which
set’s the drive’s frequency, acceleration and deceleration times, and enables the drive,
issues the run/stop, and forward and reverse commands.
It also does a fault reset.
I’ve already reset the drive parameters to factory default and the PLC to factory
default and power cycled the drive, so you know exactly where I am starting from.
I also entered these parameters for my motor, your motor parameters will probably be different.
I’m going to move these menu buttons to make more room on the screen and move things
around a bit so we can see the ladder code better.
All of the example code is written using a GS4 drive which has 10000 memory steps.
The GS20 only has 2000 memory steps so this code won’t load into a GS20.
The good news is, that’s easy to change.
We just go to options, change PLC type.
Change the title, select a GS20 drive, verify we have the correct com port and change the
filename so we don’t overwrite the original file.
Now we have ladder code that is GS20 compatible and has the correct memory configuration.
If you don’t see the comments, then make sure the show comments button is on.
Rung 0 says when we set the general purpose M1 bit, set the frequency and ramp times.
I can never remember which register is which, so let’s right click and edit the register
comments.
D50 is the frequency with two implied decimal places.
D52 is the acceleration with two implied decimal places and D53 is the deceleration also with
two implied decimal places.
That’s much better.
Of course, these D registers will need to be pre-loaded before running this command.
We’ll do that with the register monitor when we go online with the drive.
That rung used 8 of our 2,000 steps, so the next rung starts at step 8 where digital input
X0 is used to enable the drive using this special function register.
Let’s change that to M2 so we don’t have to wire up a digital input for this demo.
Keep in mind this is not the run/stop command – it just enables the drive’s outputs.
Let’s change the next rung to use M3 as the run/stop control via this special function
register.
Again, just so we don’t have to wire up a digital input.
And I’ll change the next row to use M4 to control forward and reverse via this special
function register … and change this rung to use M5 to control the fault reset.
You can find all of the special function registers in the help file here and for each drive family
you can see side by side which registers apply to each.
Looks like we are using 17 of the 2000 available steps.
I’m going to modify the comments to reflect our changes and remove all the extra words
to make them easier to read.
And let’s re-label our M bits so they will be easy to see when we run the program.
This guy is the output enable.
This guy is the run/stop.
This guy is the forward/reverse and this guy is the fault reset.
This gray background indicates all the stuff that hasn’t been compiled yet, so let’s
compile this and see how we did.
Compile is complete with no hits, no runs, no errors.
Perfect.
Go to communication menu to set up the com port.
Since the GS20 uses the dedicated USB configuration port you don’t really care about these.
We just need to make sure we are using the correct comport – which we know from the
previous video is com 11 – and that we are using RTU.
To write the program to the PLC, the PLC has to be enabled.
So I’ll go to the PLC menu and change it to PLC2 which enables the PLC in stop mode.
Great, now we click this guy to write the program to the drive – we want to write
to the drive, not read from it – and do it.
Under the communications menu, we select on-line so we can monitor what the PLC is doing.
Notice that this window is now labeled “Monitor Ladder Program”. That serves as a reminder
that we can’t edit the code while monitoring the PLC.
We also now see that we are currently in stop mode.
Click on this guy to switch to run mode.
This reminds us this is temporary while we are using this GSLOGIC utility.
How the drive acts on power up is determined by the drive's keypad menu or the digital inputs
if you are using those to control the PLC.
I’ll open a monitor window and add the M bit control registers starting at M1 and we
want 5 total registers.
We also need to set the D registers.
Let’s start with D50 which is the frequency register.
Then right click to change the value.
This tells you it is a 16 bit register and these are the formats we can use.
We’ll use the signed decimal notation of K and we want 6 hertz – which is a 600 because
there are two implied decimal places.
Hit OK and close that.
Let’s add D52 which is the acceleration and change that to two seconds, and let’s add
D53 and change the deceleration to 2 seconds.
Great, we are all set up and the PLC is running.
Let’s right click on this to toggle M1 to set the frequency and ramp times we just entered.
And we see the drive is now set to 6 hertz.
Right click this guy to enable the drive output.
And right click this guy to switch to run mode.
And sure enough, the drive ramps the motor up to speed.
Change the forward and reverse bit and the motor ramps down, changes direction and ramps
back up.
Because M1 is still enabled, if I right click D50 and change the frequency, it changes immediately.
If I disable the drive’s output we see the actual output frequency immediately goes to
zero with no ramp, and the motor free spins to a stop even though the drive is technically
still running.
Re-enable the output and the drive ramps back up to speed.
Turn this guy off to stop the drive with a controlled ramp.
That’s really all there is to it . Click here to learn more about the GS20 drives.
Click here to subscribe to AutomationDirect’s YouTube channel so you will be notified when
we publish new videos.
And click here to learn about AutomationDirect’s free award-winning support options.