Simple XOR Circuit in Siemens TIA Portal V16 with PLC Sim
Simple XOR Circuit in Siemens TIA Portal V16 with PLC Sim Public
Designing an XOR Gate Using Ladder Logic in Siemens TIA
Portal
What is an XOR Gate?
An XOR gate gives a True (1) output only
if one of the two inputs is True.
- If both
inputs are False (0,0) → Output = False
- If first
input is True, second is False (1,0) → Output = True
- If first
input is False, second is True (0,1) → Output = True
- If both
inputs are True (1,1) → Output = False
This makes the XOR gate slightly different from a standard
OR gate, which is True if any input is True—even if both are.
Step 1: Translating XOR Logic to Ladder Contacts
To implement this in ladder logic, we can use a combination
of Normally Open (NO) and Normally Closed (NC) contacts.
- For
input A (I0.0), we’ll use an NO contact.
- For
input B (I0.1), we’ll use an NC contact in
parallel.
- Similarly,
we’ll set the opposite condition in the second branch.
That means:
- Branch
1: A (NO) AND B (NC)
- Branch
2: A (NC) AND B (NO)
Both branches are placed in parallel so
that the output is energized if either condition is satisfied.
The result: The output (Q0.0) is True only
when exactly one input is True.
Step 2: Implementing in Siemens TIA Portal
- Open
TIA Portal and create a new project.
- In Device
Configuration, assign your CPU (e.g., Siemens S7-1200/1500).
- In
your main program block, start creating the ladder logic.
- Insert
an NO contact for input A (I0.0).
- Insert
an NC contact for input B (I0.1) in
series to form the first branch.
- Open
a parallel branch and build the second condition (A
as NC, B as NO).
- Connect
both branches to the output coil (Q0.0).
- Download
the program to your PLC.
Step 3: Using PLC SIM to provide user inputs
Setting Up PLC SIM (more info : TIA Portal: PLC
Simulation (PLCSIM S7-1500))
PLC SIM SIM Table
Step 3: Testing the XOR Ladder Logic
Once the program is downloaded:
- Inputs
(0,0): No signal passes → Output = Off
- Inputs
(1,0): First branch passes → Output = On
- Inputs
(0,1): Second branch passes → Output = On
- Inputs
(1,1): Both branches are blocked → Output = Off
You can verify this using the monitoring tool in
TIA Portal, where active logic paths are shown in green.
Step 4: Converting Ladder Logic to FBD
One of the great features of TIA Portal is that you can
easily switch between Ladder Logic (LAD) and Function
Block Diagram (FBD).
- Simply
right-click your main program block and convert LAD to FBD.
- The
XOR logic will automatically be generated in FBD form:
- It
shows two AND blocks with inverted inputs, connected in parallel to an OR
block.
- Download
this FBD representation to your PLC, and the behavior will be identical.
- Inputs
(0,0): No signal passes → Output = Off
- Inputs
(1,0): First branch passes → Output = On
- Inputs
(0,1): Second branch passes → Output = On
- Inputs
(1,1): Both branches are blocked → Output = Off
Comments
Post a Comment