Here is a sample CLICK PLC program, that might be used to control a stack light. Suppose we connected a switch to the first input on the CLICK CPU module, and a stack light to the first output. This simple PLC program could be used to associate the switch with the light, and to provide on/off control of the light via the switch. And yes, you might ask why not simply wire the switch to the light - and you might be able to do that in some situations, but let's assume the the switch must use low voltage DC, and the stack light requires 110VAC. Now we have an application where a relay might be used, and since a PLC is basically a collection of relays - we can use a PLC!
PLCs use a programming scheme known as ladder logic. Ladder logic is a visual representation modeled after the relay wiring schematics that the PLCs often replace. The vertical line on the left of the schematic is known as a "power rail" and the horizontal lines are called rungs. When a contact is placed on a rung and that contact is "closed", then you can imagine that power will flow across the rung to the right and power any other instructions (or coils) that may be present on that rung. In this example we have one rung of ladder logic, with a single normally-open contact controlling an output coil. When this program is compiled and transferred to a CLICK PLC and the PLC is placed in the "Run" mode - the PLC will scan this ladder logic several hundred times per second. It will evaluate the state of the first input (X001) on every scan, and if that input is active (ie. if our switch is turned "on") then the PLC will energize the first output (Y001) thereby turning on the light. If the input is inactive, the output will be de-energized
It's easy to insert and configure instructions with CLICK. Simply drag the desired instruction from the right-hand pane in the software, and drop it onto one of the rungs in the ladder window. The configuration dialog box will appear and you can fill-in-the-blanks with your desired memory addresses and any other parameters that may be optional or required. There is a help button on every instruction dialog box that will take you directly to the help file entry for that instruction.
PLCs use Memory Addresses to refer to the various bits, words, and strings of data that are used for programming. The naming convention for CLICK PLC memory addresses uses X to indicate "real-world" inputs, and Y for real-world outputs. In our example we wired the switch to the X1 input, and we then refer to that input in the program using the memory address X001. Likewise we wired the light to Y1 and we use Y001 to refer to this output. There are also naming conventions for other types of PLC memory addresses including internal addresses that are used for programming and internal functions but which may not have a "real-world" counterpart. See the help files for an in depth explanation of PLC memory addresses. With the CLICK PLC you can also assign "nicknames" to your memory addresses to help maintain your sanity.
The END instruction is required, and signals the PLC that the end of the ladder logic has been reached. Any instructions placed below the rung with the END instruction will not be executed.
One important thing to understand is that on each scan the PLC evaluates all the rungs of logic, and THEN updates the physical I/O - before scanning the ladder logic again. The "real-world" I/O is not updated on a rung-by-rung basis.
We've got more example programs here.
Our free online training videos for CLICK are here.
InterConnecting Automation Inc. is an independent company dedicated to PLC based training with an emphasis on real world experience. They also offer online training as well as on-site training for PLCs. They offer both generic PLC training (applying to any brand) and they also have training for specific PLCs including the CLICK PLC. AutomationDirect has found the CLICK training to be so useful that we use it to train our own employees. The online training is absolutley free of charge for anyone.
Click here to access the CLICK PLC specific training site at InterConnecting Automation Inc.