PPS Chapter 3
PPS Chapter 3
Advantages:
• program execution speed, as with assembly language in general instruction lists are a low overhead
language and execute faster than graphical languages.
• ILs also tend to take up less memory.
Basics of PLC Programming
Program Scan Cycle:
The PLC program is executed as part of a repetitive process referred to as a scan.
A typical PLC scan starts with the CPU reading the status of input.
Next, the application program is executed.
Next the CPU performs internal diagnostic and communication tasks.
Finally, the status of all outputs is updated.
This process is repeated continuously as long as the PLC is in the run mode.
Data Type
2. XIC
Examines if closed (Normally open contact)
If the data addressed by XIC is equal to 0 then the data addressed by OTE is equal to 0.
If the data addressed by XIC is equal to 1 then the data addressed by OTE is equal to 1
Devices
● Start/Stop push buttons
● Selectors
● Limit switch
● Proximity switch
● Light
● Internal bit
3. OTE
Turns a bit on or off.
Use OTE instruction in your ladder logic to turn on a bit when rung condition is evaluated as true.
Devices
● Light
● Motor run signal
● Internal bits
Use of Counter
1. Counters are used in applications that require items or products to be counted.
2. The CTU and CTD instructions are used to increment or decrement a counter at each false-to-true
rung transition.
● When the CTU rung makes a false-to-true transition, the accumulated value is incremented by one count.
● The CTD instruction operates the same, except the count is decremented.
• The bits and words of counter instructions have addresses that can be used in the program of a PLC.
• bit 15—Count up (CU) enable
• bit 14—Countdown (CD) enable
• bit 13—done (DN)
• bit 12—overflow (OV)
• bit 11—underflow (UN)
1. CTU- Count Up
• A count up (CTU) instruction is a PLC programming
instruction used to count the number of operations or
products produced by a system.
• A CTU instruction counts up on every false to true
transition of the logic preceding the instruction on a rung.
• The accumulated value of a CTU instruction increases by one for every false to true transition.
• A CTU instruction will allow a counter to continue to count past the preset value.
• An identically addressed RES instruction is required to reset a CTU instruction.
1. Add instruction
Use the ADD instruction to add one value to another value (Source A + Source
B) and place the sum in the destination.
2. Subtraction instruction
Use the SUB instruction to subtract one value from another value (Source A -Source
B) and place the sum in the destination.
Limit instructions:
2. Copy instruction
• The COP instruction copies blocks of data from one location into another.
• The source and destination file types must be the same except
bit (B) and integer (N); they can be interchanged.
• It is the address that determines the maximum length of the
block to be copied.
Basics of PLC Programming
ANALOG DATA
Analog signal programming: SIGNAL WORD
Converting analog data
N=Vin x 1023/10 0V 0
Where,
Vin (analog signal) is in volts (V)
5V 512
10V 1023
JSR instruction
• The JSR instruction causes the controller to start executing a
separate subroutine file within a ladder program.
• JSR moves program execution to the designated subroutine
(SBR file number).
• After executing the SBR, control proceeds to the instruction following the JSR instruction.
Return instruction
• The RET instruction marks the end of subroutine execution or the end of the subroutine file.
• It causes the controller to resume execution at the instruction following the JSR instruction, user
interrupt, or user fault routine that caused this subroutine to execute.