TP02 - Introduction to PLC Programming using Ladder
TP02 - Introduction to PLC Programming using Ladder
Hadef Warda
Snoussi Meryem
1
Solution 1: First Steps in PLC Programming using Ladder Logic
Ladder Logic relies on binary operations, where inputs and outputs are represented by
ON (1) and OFF (0) states. Normally open (NO) and normally closed (NC) contacts
define the operating conditions of circuits.
• Operation: If the condition is TRUE, the contact closes, allowing logic flow. If
the condition is FALSE, the contact remains open, blocking logic flow.
• Common Uses: Start push buttons, selector switches, digital instrumentation,
internal programming.
• Operation: If the condition is TRUE, the contact opens, blocking logic flow. If
the condition is FALSE, the contact closes, allowing logic flow.
• Common Uses: Emergency stop buttons, safety interlocks, fail-safe mechanisms.
3. Based on the documentation from Autonomy Logic, the meaning of the given
notations:
• %IX0.0 & %IX0.3: These represent digital input addresses in a PLC system.
The IX prefix indicates an input bit, while 0.0 and 0.3 specify the hierarchical
address within the input module.
• %QX0.1 & %QX0.7: These represent digital output addresses. The QX prefix
signifies an output bit, and the numbers indicate specific output locations.
The notation %QX0.8 follows the IEC 61131-3 standard for PLC addressing, where:
2
• %Q represents an output variable.
• X indicates a bit-level address (1-bit).
• 0.8 refers to the hierarchical address, where 0 is the byte index and 8 is the bit
position.
However, according to the documentation on Autonomy Logic, the least significant part
of a bit address must be between 0 and 7. Since %QX0.8 exceeds this range, it is
considered invalid in OpenPLC addressing
we create a PLC program in Ladder Diagram (LD) that toggles a LED using a push
button :
A . we create a new project and select Ladder Diagram (LD) as the programming
language.
B . we assign the push button to a digital input (%IX0.2) and we assign the LED to a
digital output (%QX0.0).
3
5. Running the PLC Program:
Solution 2: Ladder Logic for LED Toggle Using Two Push Buttons
Example 1:
• Assign %IX0.3 and %IX0.4 for the two push buttons (PB0 and PB1).
• Assign %QX0.2 for the LED.
• We verify that pressing PB1 turns the LED ON, and pressing PB2 turns it OFF.
4
4. Deploy Using OpenPLC Runtime
• After testing, we use OpenPLC Runtime to run the program on a PLC setup.
Example 2:
• Assign %IX0.5 and %IX0.6 for the two push buttons (PB0 and PB1).
• Assign %QX0.2 for the LED.
• We use a Normally Open (NO) Contact for PB0 and Normally Close (NC)
Contact for PB1.
• PB0 turns the LED ON (%IX0.5 → %QX0.2).
• PB1 turns the LED OFF (%IX0.6 → %QX0.2).
5
3. Simulate the Program
• We verify that pressing PB0 turns the LED ON, and pressing PB1 turns it OFF.
• After testing, we use OpenPLC Runtime to run the program on a PLC setup.