A coil in a PLC program, particularly in Ladder Logic, is fundamentally an output element that represents the writing of a single bit in memory. It signifies an action or output control.
Understanding PLC Coils
In the world of Programmable Logic Controllers (PLCs), programming often utilizes visual languages like Ladder Logic, which mimics traditional relay logic diagrams. In this context, elements are categorized as inputs (contacts) and outputs (coils).
Think of a coil as the destination of logic. When the conditions represented by the contacts on a rung are met (evaluating to "true"), the coil on that rung is energized. This energizing action directly corresponds to changing the state of a specific memory bit from '0' to '1' (or 'false' to 'true'). Conversely, if the logic path is "false", the coil is de-energized, setting the memory bit back to '0'.
As highlighted by the reference, each coil represents the writing of a single bit in memory. This is crucial because the state of this memory bit can then be used for various purposes:
- Controlling Physical Outputs: The most common use is to control physical devices connected to the PLC's output modules, such as turning on a motor, activating a solenoid valve, or illuminating a light.
- Internal Logic Flags: Coils can represent internal flags or markers used within the PLC program itself to track states, enable/disable logic sections, or store intermediate results.
- Timers and Counters: Coils are often used to control the enable/disable state of timer and counter instructions.
Contacts vs. Coils
To further clarify, it's helpful to compare coils with their input counterparts, contacts:
Feature | Contact | Coil |
---|---|---|
Type | Input Element | Output Element |
Function | Reading a single bit in memory | Writing a single bit in memory |
Symbol | Looks like relay contacts (--| |--- ) |
Looks like a relay coil (--( )--- ) |
Placement | Typically on the left side of a rung | Typically on the right side of a rung |
Purpose | Check status (input, flag, output state) | Control status (output, flag, timer/counter) |
- Each contact in a Ladder Diagram PLC program represents the reading of a single bit in memory, while each coil represents the writing of a single bit in memory.
Types of Coils
While the basic function is writing to memory, coils can appear in different forms in Ladder Logic:
- Standard Output Coil: The most common type. Energizes (sets bit to 1) when the rung logic is true, de-energizes (sets bit to 0) when the rung logic is false.
- Set Coil (Latch): Once energized, the memory bit remains set to '1' even if the rung logic becomes false.
- Reset Coil (Unlatch): Used to reset a memory bit that was previously set by a latch coil.
Practical Examples
Here are a few simple illustrations of how coils are used:
-
Turning on a Light:
---[ Input_Button ]----( Output_Light )---
When the
Input_Button
contact is true, theOutput_Light
coil is energized, turning on a physical light connected to the PLC's output terminal. -
Internal Flag:
---[ Condition_Met ]----( Process_Ready_Flag )---
When
Condition_Met
is true, theProcess_Ready_Flag
coil energizes, setting an internal memory bit. This flag can then be read by other parts of the program using a contact. -
Latching a Motor Start:
---[ Start_Button ]----( Motor_Run_Latch )---
Pressing the
Start_Button
energizes theMotor_Run_Latch
coil, setting a memory bit.---[ Stop_Button ]----( Motor_Run_Latch )---
A separate rung with a
Stop_Button
connected to a Reset coil is needed to turn the motor off.
In essence, coils are the actuators within the PLC's software, translating logical conditions into tangible actions by manipulating the state of memory bits.