Documente Academic
Documente Profesional
Documente Cultură
: 0020-2-24115475
Ashraf Aboshosha, Aboshosha,www.icgst.com, www.icgst.com,editor@icgst.com editor@icgst.com Ashraf
One of the primary benefits of the standard is that it allows multiple languages to be used within the same programmable controller. This allows the program developer to select the language best suited to each particular task.
SBO/ PMM/ EJ501/ Jun2011Ashraf Aboshosha, www.icgst.com, editor@icgst.com Ashraf Aboshosha, www.icgst.com, editor@icgst.com
Program Elements
Address:
o a number indicating the location, instructions, or data in the memory.
Instruction :
o a command that should be implemented PLC
Operand:
o The value in the numbers specified as the data used for a given instruction
Ladder Diagram
Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been developed to mimic relay logic. The decision to use the relay logic diagrams was a strategic one. By selecting ladder logic as the main programming method, the amount of retraining needed for engineers and trades people was greatly reduced.
The first PLC was programmed with a technique that was based on relay logic wiring schematics. This eliminated the need to teach the electricians, technicians and engineers how to program - so this programming method has stuck and it is the most common technique for programming in today's PLC.
Ashraf Aboshosha, Aboshosha,www.icgst.com, www.icgst.com,editor@icgst.com editor@icgst.com Ashraf
Mnemonic Instruction
There are other methods to program PLCs. One of the earliest techniques involved mnemonic instructions. These instructions can be derived directly from the ladder logic diagrams and entered into the PLC through a simple programming terminal.
SBO/ PMM/ EJ501/ Jun2011Ashraf Aboshosha, www.icgst.com, editor@icgst.com Ashraf Aboshosha, www.icgst.com, editor@icgst.com
SFC have been developed to accommodate the programming of more advanced systems. These are similar to flowcharts, but much more powerful. This method is much different from flowcharts because it does not have to follow a single path through the flowchart.
Programming has been developed as a more modern programming language. It is quite similar to languages such as BASIC and Pascal. Structured Text (ST) is a high level textual language that is a Pascal like language. It is very flexible and intuitive for writing control algorithms.
FBD is another graphical programming language. The main concept is the data flow that start from inputs and passes in block(s) and generate the output.
LD and LD NOT
A prefix contacts at the bus bar. If at the prefix of the bus bar is the NO(normaly open) contacts, then the instruction is LOAD or LD. For the NC(normaly closed) contacts, then the instruction is LOAD NOT or LD NOT.
Mneumonic Code
Address 000.00 000.01 Instruction LD LD NOT Operand 0.00 0.01
Operation Key
AND Instruction
AND instructions used to make the program a series contacts circuit.
1
1
0
1
0
1
Ladder diagram
Mneumonic Code
Address 000.00 Instruction LD Operand 0.00
000.01
AND
0.01
OR Instruction
OR instructions used to make the program a parallel contacts circuit. Truth table of And gate
Input 1 (1) 0 0 1 1 Input 2 (2) 0 1 0 1 Output (Q) 0 1 1 1
Ladder diagram
Mneumonic Code
Address Instruction Operand
000.00
000.01
LD
OR
0.00
0.01
AND LD Instruction
ANDLD instruction is used to connect two or more circuit series that began with the LD instruction.
Ladder diagram
Mneumonic Code
Address 000.00 000.01 000.02 000.03 Instruction LD LD OR AND LD Operand 0.00 0.01 0.02 -
OR LD Instruction
OR LD instruction is used to connect two or more parallel circuit that began with the LD instruction. Ladder diagram
Mneumonic Code
Address 000.00 000.01 000.02 000.03 000.04 Instruction LD AND LD AND OR LD Operand 0.00 0.01 0.02 0.03 -
OR LD and AND LD
The union between a series connection which is connected into one, so if there are two series circuits are combined into one, then the instruction is OR LOAD. The union between a parallel connection which is connected into one, so if there are two parallel circuits are combined into one, then the instruction is AND LOAD.
NOT Instruction
Instructions NOT be used prior to entering the input address to declare that normally closed contacts. Truth table of And gate
Input 1 (1) 0 1 Output (Q) 1 0
Ladder diagram
Mneumonic Code
Address 000.00 000.01
Ashraf Aboshosha, Aboshosha,www.icgst.com, www.icgst.com,editor@icgst.com editor@icgst.com Ashraf
Instruction LD NOT
Operand 0.00
OR and OR NOT
The instruction for parallel connection in the ladder. For NO(normaly open) contacts, then the instruction is OR. For NC(normaly closed) contacts, then the instruction is OR NOT
XOR
MOVE (MOV)
Move instruction is a function to move or transfer or to copy data from source (S) to destination (D). To operate MOV press FUN 21.
ADD
Have function to add three pieces of parameters: data 1 (Au), data 2 (Ad) and carry (CY), then the results are placed on data 3 (R). carry will be set to 1 if the sum is greater than 9999.
SUB
Have function to subtract three pieces of parameters: data 1 (Mi), data 2 (Su) and carry (CY), then the results are placed on data 3 (R). If the result is negative then carry will be set to 1.
Turns ON B for an ON execution condition; does not affect B for an OFF execution condition
Ladder diagram
Mneumonic Code
Address 000.00 000.01 000.02 000.03 Instruction LD SET LD RSET Operand 0.00 0.04 0.02 0.04
Timing Chart
A timer is activated when its execution condition goes ON and is reset (to SV) when the execution condition goes OFF. Once activated, TIM measures in units of 0.1 second from the SV. If the execution condition remains ON long enough for TIM to time down to zero, the Completion Flag for the TC number used will turn ON and will remain ON until TIM is reset (that is, until its execution condition goes OFF).
N : Timer Number --> 000 - 511 SV : Set value (#0050) 5 sec (50 x 0.1sec)
Ladder diagram
Mneumonic Code
Address 000.00 000.01 Instruction LD TIM Operand 0.01 000
#100
Timing Chart
Timer On Delay
S7 Timers
There are 5 S7 timers available (STL) 1. S_PULSE Pulse Timer (SP) 2. S_PEXT Extended Pulse Timer (SE) 3. S_ODT On-Delay Timer (SD) 4. S_ODTS Retentive On-DelayTimer (SS) 5. S_OFFDT Off-Delay Timer (SF)
S7 Timers
o o o
Each timer uses one 16 bit word. Bits 0 11 contain the time value in BCD. The time value has the format
5T#aH_bM_cS_dMS where H = hours, M = minutes, S = seconds, and MS = milliseconds and a, b, c, d are defined by the user.
For example: S5TIME#4S = 4 seconds s5t#2h_15m = 2 hours and 15 minutes S5T#1H_12M_18S = 1 hour, 12 minutes, and 18 seconds The maximum value is 2H_46M_30S
Ashraf Aboshosha, Aboshosha,www.icgst.com, www.icgst.com,editor@icgst.com editor@icgst.com Ashraf
STL Timers
Other Timer Commands FR - Enable (restart) a Timer L - Load Current Timer Value into ACCU 1 as Integer LC - Load Current Timer Value into ACCU 1 as BCD R - Reset Timer stops and clears values
Counter
is used for count the setting value (SV) towards 0 when the pulse counter (CP) changes from OFF to ON. After the counter value changes to 0 then the counter output status will change from OFF to ON and will persist as long as the reset button (R) has not been pressed. When the reset button is pressed, status of the output counter will be OFF and the counter value back to the original setting value. The number of counter that can be used up to 511. Do not give the same number on counter Timer.
Timing Chart
PLC.
o
o
CTU Counter
Each time the input rung logic goes from false to true, the counter counts up over a range of -32768 to 32767. When the accumulated value reaches the preset value, the .DN bit becomes 1. The accumulated value is retained until the RES instruction is used to reset the counter.
CTU Counter
CTD Counter
Each time the input rung logic goes from false to true, the counter counts down over a range of -32768 to 32767. When the accumulated value reaches the preset value (usually 0), the .DN bit becomes 1. The accumulated value is retained until the RES instruction is used to reset the counter.
S7 Counters
Siemens
o o o
S7 Counter Memory
You provide a counter with a preset value by entering a number from 0 to 999, for example 127, in the following format: C#127. The C# stands for binary coded decimal format (BCD format: each set of four bits contains the binary code for one decimal value).
S7 S_CD Counter
C no. - Counter identification number CD - Count down input S - Set input for presetting counter PV - Enter counter value as C#<value> in the range from 0 to 999 R - Reset counter input CV - Current counter value, hexadecimal number CV_BCD - Current counter value, BCD Q Status of the counter
S7 S_CD Counter
S_CD (Down Counter) is set with the value at input PV if there is a positive edge at input S. The counter is reset if there is a 1 at input R and the count value is then set to zero. The counter is decremented by one if the signal state at input CD changes from "0 to "1" and the value of the counter is greater than zero. If the counter is set and if RLO = 1 at the inputs CD, the counter will count accordingly in the next scan cycle, even if there was no change from a positive to a negative edge or vice versa. The signal state at output Q is "1" if the count is greater than zero and "0" if the count is equal to zero.
S7 S_CD Counter
If I0.2 changes from "0" to "1", the counter is preset with the value of MW10. If the signal state of I0.0 changes from "0" to "1", the value of counter C10 will be decremented by one - unless the value of C10 is equal to "0". Q4.0 is "1" if C10 is not equal to zero.
S7 S_CU Counter
If I0.2 changes from "0" to "1", the counter is preset with the value of MW10. If the signal state of I0.0 changes from "0" to "1", the value of counter C10 will be incremented by one - unless the value of C10 is equal to "999". Q4.0 is "1" if C10 is not equal to zero.
S7 S_CUD Counter
If I0.2 changes from "0" to "1", the counter is preset with the value of MW10. If the signal state of I0.0 changes from "0" to "1", the value of counter C10 will be incremented by one - except when the value of C10 is equal than "999". If I0.1 changes from "0" to "1", C10 is decremented by one - except when the value of C10 is equal to "0". Q4.0 is "1" if C10 is not equal to zero.
The counter C5 is preset with the value of 100 if there is a positive edge at input I0.0 (change from "0" to "1"). If there is no positive edge, the value of counter C5 remains unchanged.
STL Counters
FR
Enable Counter (Free) L Load Current Counter Value into ACCU 1 LC Load Current Counter Value into ACCU 1 as BCD R Reset Counter to 0 S Set Counter Preset Value CU Counter Up CD Counter Down
Timing Chart
Summary
SBO/ PMM/ EJ501/ Jun2011Ashraf Aboshosha, www.icgst.com, editor@icgst.com Ashraf Aboshosha, www.icgst.com, editor@icgst.com
Summary
Summary
Summary
(a)&(b) Alternative ways of drawing an electric circuit, (c) comparable rung in a ladder program
PLC: example 1
Pressure_Switch is ON Warning_Light ON
PLC: example 1
STEP 1:
Write this logic into a PROGRAM STEP 2: Load program into PLC STEP 3: Connect the sensor output to External Input terminal. STEP 4: Connect the PLC External Output Terminal to Warning Light STEP 5: EXECUTE the logic program on the PLC.
Ashraf Aboshosha, www.icgst.com, editor@icgst.com Ashraf Aboshosha, www.icgst.com, editor@icgst.com
PLC: example 1
PLC: example 1
IF
THEN
PLC: example 2
Outer mat ON warning light ON Inner mat ON warning light ON AND Robot OFF
PLC: example 2
Two actuators: Warning light, Robot master switch
LOGIC for Warning light External Input 1: outer mat
PLC: example 2
PROBLEM ?
PLC: example 2
LOGIC for Robot Robot must STAY OFF until manual reset to ON Solution: LATCH
External Input 2: inner mat Internal (logical) relay
latch
PLC: example 2
LOGIC for Robot Robot must STAY OFF until manual reset to ON
Solenoid actuated when: (i) ON signal from number-pad outside door (ii) ON signal from door-open switch inside door Solenoid ON for 5 sec, then OFF While O:0/1 remains ON, Timer COUNTS DOWN from PRESET
I:0/1
I:0/2
B1
B1 T4: 0 EN Base: Preset: Accum : B1 T4: 1 EN Base: Preset: Accum : 0.01 6000 0 T4: 2 EN Base: Preset: Accum : B1 T4:0 T4:1 0.01 7500 0 T4:2 DN T4:2 DN T4:2 DN C5: 0 EN Preset: Accum : C5: 0 DN I:0/3 50 0 O:0/3 O:0/0 0.01 3000 0
I:0/1 : System On I:0/2 : Em ergency Stop I:0/3 : Lim it Switch O:0/0 O:0/1 O:0/2 O:0/3 : : : : Soa p Water On Rinse On Scrubber On Ac tivate Scrubber Change
B1
Notice how B1 and the time r outputs are used to c ontrol the logic according to the required timing.
B1
O:0/1
B1
O:0/2
O:0/2 CTU
Car arrives limit switch ON Limit switch ON Washer ON Washer ON: (i) Soapy water SPRAY ON (30 secs) (ii) Rinse: clean water SPRAY ON (30 secs) (iii) Automatic scrubber brushes car (15 secs) (iv) After washing 50 cars, the scrubber brush Auto-change
T4:0 RES
I:0/3
T4:1 RES
I:0/3
O:0/3