Automation and Robotics Week 02 Theory Notes 20ME51I
Automation and Robotics Week 02 Theory Notes 20ME51I
PLC Program
Here is PLC program to implement various logic gates, along with program explanation and run time test
cases.
a) AND
• By connecting Normally Open / XIC contacts in series, AND gate can be implemented.
• When both inputs are set to 1, then and then only output goes high.
b) OR
• By using just one Normally Closed / XIO contact, NOT Logic Gate can be implemented.
• Inverted state of input is obtained as an output.
d) NOR
• By connecting Normally Closed / XIO contacts in series, NOR Logic Gate can be implemented.
• If both inputs are Reset to 0, output goes High otherwise remains in Low state.
• Or by inverting output of a OR Gate, that is by using output of OR Gate as an input of NOT Gate,
NOR Gate can be implemented.
e) NAND
• By connecting Normally Closed contacts in parallel to each other, NAND Gate can be implemented.
• Or by simply inverting output of AND gate, NAND Gate can be implemented.
f) EX-OR
• By connecting XIC and XIO in series with parallel to XIO and XIC in series as shown in diagram
above, EX-OR Gate can be implemented.
• When both inputs are identical, output is 0. Output is high when A ≠ B.
• Note here that XIC of first series contacts and XIO of second series contacts must be given same
address and similarly for the other two.
g) EX-NOR
• By connecting two XIO contacts in series with parallel to two XIC contacts in series, EX-NOR gate
can be implemented.
• When both inputs are identical A=B=O or A=B=1, output goes high.
• It implies same here as in EX-OR gate that address must be given same.
• By inverting output of EX-OR gate, implementation of EX-NOR can be accomplished.
Inputs Output
A NOT
0 1
1 0
Ladder Diagram:
There are two parameters in each block, Source A & Source B –where values are stored.
Description of Comparator Blocks:
EQU: Equal block is used to compare the two values stored in Source A and source B and gives output as
“1” if both are equal and “0” if both are not equal.
LES: Lesser than block is used to compare the two values stored in Source A and source B and gives output
as “1” if Source A value is Lesser than Source B value and “0” if Source A value is greater than or equal to
Source B value.
LEQ: Lesser than or equal to block is used to compare the two values stored in Source A and source B and
gives output as “1” if Source A value is lesser than or equal value to Source B value and “0” if Source A value
is greater Source B value.
NEQ: Not equal block is used to compare the two values stored in Source A and source B and gives output
as “1” if Source A value is not same as Source B value and “0” if Source A value is same as Source B value.
GRT: Greater than block is used to compare the two values stored in Source A and source B and gives output
as “1” if Source A value is Greater than Source B value and “0” if Source A value is lesser than or equal to
Source B value.
GEQ: Greater than or equal to block is used to compare the two values stored in Source A and source B and
gives output as “1” if Source A value is Greater than or equal value to Source B value and “0” if Source A
value is Lesser Source B value.
Logic Description:
RUNG 0000: When Start switch is pressed, N7:0 is the water level value which is Compared with 5 and 95
using GEQ and LEQ block to turn ON Motor. (i.e-Motor should turn ON if water level is between 5 and 95)
RUNG 0001: Low level alarm is triggered, when water level goes below 5. Less than block is used to perform
this function.
RUNG 0002: High level alarm is triggered, when water level goes above 95. Greater than (GRT) block is
used to perform this function.
RUNG 0003: Steamer output is turned ON when water level reached exactly at 95.
RUNG 0004: System under control output always in ON condition when water level is not at 100.
PLC Comparator Programming
Program Description
RUNG 0000: The input I:0/0 is used to turn on Motor 1.
RUNG 0001: The input I:0/1 is used to turn on Motor 2.
RUNG 0002: The input I:0/2 is used to turn on Motor 3.
RUNG 0003: The input I:0/3 is used to initiate the jump function (Q2:0).
RUNG 0004: The input I:0/0 & I:0/4 is used to turn on Motor 4.
RUNG 0005: The input I:0/1 and I:0/5 is used to turn on Motor 5.
Rung 0007: Label instruction is used to finish the jump function. The input I:0/6 and I:0/2 is used to turn
on Motor 6.
When Jump condition is OFF: All outputs will turn ON/OFF according to respective input.
When Jump condition is ON: Rung 4, 5 & 6 are completely skipped till label function.
Problem Description
Add temperature outputs of two temperature transmitters and display the total temperature. Update display
every 10 seconds when this system is active using Subroutine program.
Problem Solution
• Using subroutine has an advantage that process is not affected by any other data in subroutine program
unless and until the subroutine is called.
• This is very useful in displaying various data on the same display with a particular time delay.
• For example, we can use the same display to show Pressure readings for the first 5 seconds and
Temperature reading for the next five seconds and so on.
• When we use subroutine instruction, Subroutine address must be same in JSR instruction of main program
and RET instruction of subroutine program.
Problem Description
Implement various mathematical functions in PLC using Ladder Diagram programming language.
Problem Solution
• Use all the Math Instructions to implement various Mathematical Arithmetic Functions.
• Use ADD to add one piece of data to another.
• Use SUB to subtract one piece of data from another.
• Use MUL to multiply one piece of data by another.
• Use DIV to divide one piece of data by another.
• Use SQR to find the square root of a piece of data.
• Use NEG to change the sign of a piece of data.
PLC Program
Here is PLC program to do Mathematical Functions, along with program explanation and run time test cases.
List of Inputs and Outputs
I:1/0 = Input to Add (Input)
I:1/1 = Input to Subtract (Input)
I:1/2 = Input to Multiply (Input)
I:1/3 = Input to Divide (Input)
I:1/4 = Input to find Square Root (Input)
I:1/5 = Input to change the sign of a Number (Input)
N:7/0 to N:7/9 = Integer Number Location (Input)
O:6 = Display (Output)
Program Description
• Program is very clear to understand.
• N7:0 to N7:9 contain Integers of which operation is to be performed.
• In the ADD instruction, data of N7:0 and N7:1 are added and sent to destination which is Display with
output address O:6.
• Similarly, all other operations are performed.
• Though, we must know that the answers stored in the destination are in Hexadecimal form, hence we have
to convert this data into BCD form and then send it to display output O:6.
Problem Description
Implement controlling of various lights in PLC using Ladder Diagram programming language using Bit Shift
Registers.
Problem Solution
• Define order of lights.
• Use Bit Shift Registers to implement any sequence of lights.
• Double check if the order of light is made correctly and connections are made properly.
• Use latching coil for Master Start and Stop for prevention against malfunctioning.
• 0.1 Time Base function availability is useful to shift register bits very quickly.
• By using this, we can make lights blink.
• Check if bit addresses provided to Light output addresses are correctly chosen or not.
• Provide 16bit of length to Bit Shift Register, by adding this total 16 number of lights can be controlled.
• This limitation can be overcome by using more than one registers or with same length, more than one
shift registers.
PLC Program
Here is PLC program to Control Lights in a Sequence, along with program explanation and run time test cases.
List of Inputs and Outputs
I:1/0 = Master Start (Input)
B3:0 = Altering Register (Output Register)
R6:0 = Control Register (Storing Register)
R6:0/UL= Used for Wraparound operation (Unload Bit)
B3:0/0 = Bit input to Output 0 (Input Bit)
O:2/0 = Output 0 (Output)
B3:0/1 = Bit input to Output 1 (Input Bit)
O:2/1 = Output 1 (Output)
B3:0/2 = Bit input to Output 2 (Input Bit)
O:2/2 = Output 2 (Output)
B3:0/3 = Bit input to Output 3 (Input Bit)
O:2/3 = Output 3 (Output)
T4:0 = Timer to shift bits (Timer)
Program Description
• Here in the Ladder Diagram, Outputs are controlled by the bits set in the register B3:0.
• These outputs are controlled in accordance to shifting of bits from Right to Left.
• This shifting is controlled by Timer T4:0.
• Timer is set to auto reset mode by setting XIO T4:0/DN bit of the same timer to its input.
Master Start is included as well. This has to be a toggle switch otherwise latching rung is used in case
Push Buttons are available and one more Stop PB must be added to Master Stop.
• Whenever Timer Done bit is set, that bit sends False to True signal to Bit Shift Register which performs
Shifting of bits to Left.
• Time delay is 0.1secs here, so that shifting is really quick.
• Length indicates the number of bits to be shifted, or the file length in, in bits.
• The Last bit is shifted out of the array and stored in the unload bit, R6:0/UL. The status that was previously
in the unload bit is lost. So, for wraparound condition, last bit of the array B3:0/0 is set to the position to
the UL bit.
• After every 0.1secs, bits are shifted and orders outputs are controlled.
The demo version allows to easily test and get acquainted with LOGO! Soft Comfort. You can create,
simulate, archive and print out switching programs for all LOGO! devices on PC. Restriction: You cannot
transfer switching programs in LOGO! or communicate online with the LOGO! This is only possible with the
full version of the software.
The demo version allows to transfer programs which have been created with the demo version to LOGO!
The free WBT is an ideal addition to the LOGO! programming training.The download contains the necessary
files for the operating systems supported by LOGO! Soft Comfort V8 (Windows, Linux and MacOSx). You
can find license conditions and disclaimers for Open Source software. You can download the latest version of
LOGO! Soft Comfort by using the link below based on your system configurations:
https://new.siemens.com/global/en/products/automation/systems/industrial/plc/logo/logo-software.html
or
https://support.industry.siemens.com/cs/document/109782616/logo!-soft-comfort-v8-demo?dti=0&lc=en-
WW
If you insist on using the same version as mine download from any of the links below but be alert for virus
and pirated versions, try not to use crack use demo version for best results, also be cautious in x32 bit or x64
bit Installation:
https://plc247.com/download-logo-soft-comfort-v8-3-full-version/
I request all those who use this manual to support “Siemens Technology” for their innovative software
LOGO! Soft Comfort. For contact and support use the links below:
https://support.industry.siemens.com/cs/products?dtp=ExampleOfUse&mfn=ps&pnid=13632&lc=en-WW
Step (1): Open Logo! Soft Comfort and Click Down arrow on “New” command and Select “Function Block
Diagram”
Step (2): Using Constants select desirable circuit blocks and arrange in the Interface.
Step (3): Use Tool Bars to joint the circuits or giving comments
Step 05: Click Debug symbol in Left and Check Debugger Output in right side.
Step 06: If you click the padlock, you can set the value in a new popup:
Step 06: Toggle the Input Value and check the Output
Problem Description (09): Example for PLC Program using Structured Text [ST]
Let’s recreate the basic designs I created with LL before in OpenPLC and get them running on the Arduino.
The physical Arduino circuit is the same as before (see here), and of course OpenPLC is installed and
configured in the same way also (see here).
Two-Button Latching Circuit
The variables are the same as before:
The code is:
IF PB1 THEN
LED := TRUE;
END_IF;
IF PB2 THEN
LED := FALSE;
END_IF;
Even if you’ve never done any coding before, I’m sure this will make sense. If PB1 is pressed,
set LED to TRUE (on). If PB2 is pressed, turn it off.
Note how PB1 doesn’t have to be physically held on to keep LED on; once it is pressed, LED is set to TRUE,
and this stays until it is changed. With LL we needed a contact linked to the LED in parallel with the push
button to latch it; in ST, it’s effectively self-latching.
A new tab will appear, and the person will become a STOP sign:
On right panel, it will change to the Debugger tab, but currently it’s empty:
To Debug (view) the individual variables, click the glasses icon for each in the left panel:
Now, if you hover over the value (in this case, False), you get a new menu:
If you click the padlock, you can set the value in a new popup:
Click Toggle value then OK, and the chart will change:
Interestingly, if you hold PB2 TRUE (i.e. keep the button pressed), LED stays FALSE even if you press PB1.
This is because, in the ST, the code for PB2 comes after the code for PB1
Uploading to the Arduino works in the same way as with LL and creates the same result as the Debugger.
Unsurprising, really.
Problem Description (09): Example One-Button Latching Circuit with Emergency Stop
Next one! The initial thought is this:
IF PB1 AND NOT PB2 THEN
LED := NOT LED;
END_IF;
IF PB2 THEN
LED := FALSE;
END_IF;
The second line, quite simply, toggles the value of LED to the opposite of what it
was. TRUE becomes FALSE, and FALSE becomes TRUE. If PB2 (emergency stop) is pressed, this will not
happen. And whatever value LED is, if PB2 is pressed, the LED goes off. However, this creates a strange
effect:
Day 05 Session:
Developmental Weekly Assessment + Industry Assignment
Day 06 Session: Industry Class on PLC Programs practiced in Industry + Industry Assignment