https://www.automationdirect.com/VFD
(VID-DR-0040)
Live demo using Analog Input #1 to control the drive via the Built-in PLC.
Our FREE Practical Guide to Programmable Logic Controllers eBook: https://www.automationdirect.com/ebooks/plc-handbook
Other videos show us how to use an analog input to control the drive’s frequency using the drives parameters. But what if we want to take the analog input and scale it in a specific way or otherwise manipulate it before it controls the drives frequency? Well, that’s where having an on-board PLC can come in handy. Let’s go to the examples folder which is usually under documents, AutomationDirect, GSLogic. There’s two folders – one for examples on how to use all of the instructions and another with application examples. We want this Analog Input 1 for frequency control example. This video assumes you are familiar with setting up the GS4 Drive for PLC programming. If you are not familiar with the GS4 PLC, then the quick start videos will get you up to speed quickly. Looks like this example uses the drives forward input as an enable, the reverse input as a RUN command, Digital input 1 as the direction and digital input 2 as a fault reset. How did I know which drive inputs those were? Easy – this button takes you right to the help topic that maps the Drives digital inputs to the PLC’s X inputs and the drives outputs to the PLC’s Y outputs. I love that. When the enable is active, we read the analog input, convert it to a floating-point number and put that in register D46 How did I know this was Analog input 1? Again, this button takes me to that same chart and down here we see that analog input 1 can be read directly from special function register D1028. We can also see the analog output mappings. Could we have requested this information directly from the drive’s parameters? Sure, but that requires extra work on our part. These dedicated special function registers really make things easy. Next, we take the floating-point version of the analog input - which goes from 0 to 100 – and multiply it by .6 to scale it to 0 to 60 Hz. We then convert that back to an integer, and use that to set the new frequency value. These two are the acceleration and deceleration which we would have to be set before using this instruction of course. So instead of doing that, let’s highlight the instruction, then double click on it to just put a constant 2 seconds in for acceleration and a constant 2 seconds in for deceleration. K means it is a decimal constant and both of these have two implied decimal places so a 2 becomes a 200. By the way, you can see all the memory data types in HELP under Contents, Basics, Data types. Or just go directly to help topic GSL100. That’s all there is to it. Read the analog input, scale it, and use it to control the frequency. These inputs just control special function bits which directly control the RUN/STOP, Direction and fault reset of the drive. And don’t forget – since the PLC is using this input, the drive won’t see it as a forward command – or whatever else you may have configured it for in the drive. The PLC always gets control of the I/O IF the PLC is not disabled – that is, it’s in RUN or STOP mode – AND the PLC is using that I/O in its ladder code. That’s really important to remember – the PLC always gets control of any I/O it’s using regardless of how it was configured in the drive. Well, let’s try it. Write the program to the PLC. Yes, we want to compile it. I was running the PLC prior to this demo so it’s asking if I really want to stop it - I do. And yes, I want to go back to run mode. If your drive isn’t in run mode, just click this button right here. Let’s enable monitoring to see all the values right on the ladder diagram. You could also bring up a separate monitor window with this button if you want to. I have some switches connected to the drives inputs, If I flip the enable switch we see that turn green and if I turn on the RUN contact, sure enough the motor starts spinning. If I change the analog potentiometer that I have connected to analog input 1, the motor reacts accordingly and we see the raw analog input value here and the scaled value here and we even see all the intermediate results too which makes debugging a snap. In this example, we have a switch connected to one of the drive’s inputs controlling direction by writing to special function register 1026. If I flip the switch, the drive decelerates over 2 seconds, reverse direction and accelerates back up over 2 seconds. Exactly what we expect. What if we wanted to control the direction automatically from the potentiometer? That is, have 0 to 5 volts control the reverse direction and 5 to 10 volts control the forward direction. Can we do that from the PLC? Sure! Let’s delete that rung that controls motor direction from a switch. Up here we converted the 0 to 10-volt input to 0 to 60 Hz. Let’s subtract 30 Hz. Now we have minus 30 to plus 30. Multiply that by 2 and we have -60 to +60Hz. Done, right? Well, no not yet. Because the Drive doesn’t understand negative frequency numbers from the PLC. To fix that we’ll compare that number with zero and put the result in M0, which tells us if the frequency is less than zero. If the frequency is positive, then go ahead and issue frequency command. If the Frequency is negative, then change the direction by writing to register M1026, multiply by a minus 1 to get a positive frequency value and use that in the frequency command. Let’s zoom out a little bit so we can see all the new rungs. Great! Let’s write that to the drive. Yes, compile it. Yes, I know the drive is in run mode. Yes, please return to run mode. Turn on monitoring. Now the top half of the potentiometer goes from 0 to 60 Hz and the bottom half reverses direction for 0 to 60 Hz. Perfect. Well, that should give you a pretty good idea of the kinds of things you can do with the GS4 drives built in PLC. You are no longer limited by what the Drive Parameters allow you to do. Click here to learn more about the GS4 Drive. Click here to learn about AutomationDirect’s free support options and click here to subscribe to AutomationDirect’s You Tube Channel so you will be notified when we publish new videos.
Voted #1 mid-sized employer in Atlanta
Check out our
job openings