Learn how to use Time and Date functions on the GS4 Variable Frequency Drive (VFD) including the caveats you need to know about to be successful.
PLC – Real Time Clock Using time functions in the GS4’s built in PLC is easy. You can read the time, compare the time, Add time, subtract time, and even compare if something happened during a block or zone of time. Note that you can’t change the time from the PLC. A nd there are simple examples of all of those in the examples folder. There are a few things you need to know before using the PLC’s time functions so let’s bring up the TRD example program so we can see those in action. This program simply reads the time from the drive into 6 registers starting at D20. Check the com settings – check the com port – looks good – and the rest of these are correct for my system. Write the program to the PLC in the drive. It’s warning me that I have a program running, that’s fine I know that .. and yes I do want to return to run mode. If you aren’t in run mode, then go ahead and do that now by clicking here. If we open a monitor window we see that this example already has the registers populated for us. Let me re-arrange that so we can see it and the ladder code. And let’s add M0 so we can enable the TRD instruction. Again, make sure you are on line and the drive is in RUN mode. The first thing to understand is TIME IS STORED IN THE KEYPAD. The drive watches the Keypad and if it sees a change uses that to update the time it maintains locally in the drive. Let’s take a look at how that impacts things. Here are the 6 registers the Time Read instruction is going to fill and we can see they are not getting updated right now because we haven’t enabled the Time Read instruction with this M0 contact yet. But if we look down here, we see a set of Special Function Registers that also have the time data and they ARE getting updated. So … do we really need to use the TRD instruction to get time information? Not really, because the GS4 Drive automatically puts the current time information in these special function registers so the PLC can just read whichever time element it wants whenever it wants without having to mess with the TRD instruction. If we do turn on M0 – I’m going to toggle the on-line button so that shows up on the ladder diagram - we see the seconds D register is now getting updated by the TRD instruction. If I turn M0 off, the seconds D register stops getting updated, but the special function register does continue to get updated. If I re-enable M0, then the Seconds D register picks up the CURRENT time – exactly what we expect. If I stop the PLC, the monitor window stops getting updated of course, but as soon as I put the PLC back in RUN mode, we see the special function register starts updating again and it is with the correct current time because the clock continues to be updated even while the PLC is stopped. Ok, that all makes sense. Here is the thing you need to remember. Let’s pull the keypad out. Look, the time is still getting updated. Why? Well, again, because the drive maintains a local copy of the time as long as it is powered up. Let’s record the current time and date. Now, let’s put a DIFFERENT keypad in the drive. Ahh, look at that! The drive saw a new keypad and automatically adjusted its internal clock to match that keypad. That’s really important to understand. Time is stored in the keypad. If your PLC Ladder code uses time functions, and you swap out keypads that don’t have the same time settings, you can get some unexpected results. So be careful with that. And if you power cycle the drive with no keypad installed, the drive won’t be able to do that initial read of the time so it’ll lose track of the time and again, your PLC time functions might not work the way you expect. The good news is Help topic 208 covers the various error bits and codes. Using those, the PLC can see when there is a time math error and if a something has happened to the keypad and react accordingly. So please, take advantage of those to help failsafe your PLC code. The next thing to keep in mind is the time in the keypad is maintained by a large capacitor – not a battery. And that capacitor can only hold the time information for about a week. So, if that keypad is pulled out of the drive or the drive is powered down for more than a week, it can’t guarantee it will return the proper time. It’s not a permanent time keeping device. It’s really intended to be used to setup one drive and then move the keypad from drive to drive to quickly copy parameters to other similar drives and keypads. While the PLC can read the time AND the date, it can only manipulate time – that is, hours, minutes, seconds using the time functions. Those time functions don’t operate on days months or years. The PLC can’t write to the time registers. The PLC can read the time and perform operation on time numbers, but it can’t write to the drives time registers. You can see that in the special function register chart – they are read only registers. The only way to change the time in the drive and keypad is to go to the main menu, and scroll down to time setup. That’s sets the time in the keypad. The drive will see that change and automatically update its local time and date registers. Of course, you can always see the drives current time right here on the keypad display and you can tell if the PLC is running and what it’s status is right here. Great, that ought to be enough to get you started with using time and date in your ladder code. Click here to learn more about the GS4 Drives. Click here to learn about AutomationDirect’s free support options. And click here to subscribe to AutomationDirect’s YouTube channel so you will be notified when we publish new videos.