TON OPERATIONThe TON instruction starts accumulating time when the rung goes true, and continues until one of the following happen: • The rung goes false • The accumulated value equals i
Trang 1DAY 2
SESSION 2
LADDER LOGIC PROGRAMMING – TIMER &
COUNTER
Trang 2Be able to
• Describe the function of an on-delay timer
• Describe the function of an off-delay time
• Describe the instances in which one would use a retentive
timer
• Describe the function of an up-counter
• Describe the function of a down-counter
• Describe the instances in which one would use an up- versus a down-counter
• Define preset value, accumulative value, and timer or counter
address
Trang 3SUB-WINDOW : TIMER / COUNTER
Timer is used to delay turning on or off output for maximum 9.1
hours
Counter is used to count up and down over a range of -32,768 to
+32,768
Trang 4TIMER INSTRUCTIONS
• Timer Off Delay (TOF)
• Retentive Timer On (RTO)
Trang 5TIMER ON DELAY (TON)
Use TON instruction to turn an output on after the timer has been
on for a preset time interval
Status bit:
EN DN
TON Timer On Delay
Trang 6TON OPERATION
The TON instruction starts accumulating time when the rung goes true, and continues until one of the following happen:
• The rung goes false
• The accumulated value equals its preset value
• A reset instruction resets the timer
• The processor resets the accumulated value when the rung condition go
false, regardless of whether the timer timed out or not
Trang 7TON TIMING DIAGRAM
Trang 8TON STATUS BITS
This Bit: Is Set When: Indicates: And Remains Set Until One of the
Following Occurs:
Timer Enabled
.EN (bit 15)
the rung goes true that timer is enabled • the rung goes false
• a reset instruction reset the timer
Timer Timing Bit
.TT (bit 14)
the rung goes true that a timing
operation is in progress
• the rung goes false
• the DN bit is set (.ACC = PRE)
• a reset instruction reset the timer Timer Done Bit
.DN (bit 13)
the accumulated value is equal to the preset value
that a timing operation is complete
• the rung goes false
• a reset instruction resets the timer
Trang 9When the input condition is true, the processor increments the accumulated value
of Timer_1 in 1 milisecond increment
Sets the output while the timer is timing
Sets the output when the timer is done timing
TIMER ON LADDER DIAGRAM
EXAMPLE
Trang 10TIMER OFF DELAY (TOF)
Use TOF instruction to turn an output off after the timer has been
off for a preset time interval
Status bit:
Trang 11TOF OPERATION
The TOF instruction starts accumulating time when the rung goes
false, and continues until one of the following happen:
• The rung goes true
• The accumulated value equals its preset value
• A reset instruction resets the timer
• The processor resets the accumulated value when the rung condition go
true, regardless of whether the timer timed out or not
Trang 12TOF TIMING DIAGRAM
Trang 13TOF STATUS BITS
This Bit: Is Set When: Indicates: And Remains Set Until One of
the Following Occurs:
Timer Enabled
.EN (bit 15)
the rung goes true that timer is
enabled
• the rung goes false
• a reset instruction reset the timer
Timer Timing Bit
• the rung goes true
• the DN bit is set (.ACC = PRE)
• a reset instruction reset the timer
Timer Done Bit
.DN (bit 13)
the rung goes true that a timing
operation is complete
• the accumulated value is equal
to the preset value
Trang 14EXAMPLE TOF
LADDER DIAGRAM
When the input condition goes false, the processor starts incrementing the accumulated value of Timer_1 in
6-milisecond increments until the input goes true
Sets the output while the timer is timing
Resets the output when the timer is done timing
Trang 15RETENTIVE TIMER ON (RTO)
Use RTO instruction to turn an output on after the timer has been
on for a preset time interval
Status bit:
Trang 16RTO OPERATION
The RTO instruction begins timing when its rung goes true
As long as the rung remains true, the timer updates the
accumulated value each program scan, until it reaches the preset
value
The RTO instruction retains its accumulated value even if one of
the following occurs:
• The rung goes false
• The processor faults or loses power
Trang 17When the input is true, the processor starts incrementing the accumulated value of T4:2 in 6-second increments The timer values remain when the input goes false.
Sets the output when the input is true and the timer is timing
Sets the output when the input is true and the accumulated value is greater then or equal to the preset value
EXAMPLE RTO
LADDER DIAGRAM
Trang 18RTO TIMING DIAGRAM
Trang 19RTO STATUS BITS
This Bit: Is Set When: Indicates: And Remains Set Until One of
the Following Occurs:
Timer Enabled
.EN (bit 15)
the rung goes true that a timing
operation is in progress
• the rung goes false
• a reset instruction reset the timer
Timer Timing Bit
.TT (bit 14)
the rung goes true that a timing
operation is in progress
• the rung goes false
• the DN bit is set
• the accumulated value is equal to the preset value (.ACC = PRE)
• a reset instruction reset the timer Timer Done Bit
.DN (bit 13)
the accumulated value
is equal to the preset value
that a timing operation is complete
• the DN bit is reset with the RES instruction
Trang 20EXAMPLE RTO
LADDER DIAGRAM
When the input is true, the processor starts incrementing the accumulated value of Timer_1 in 6-milisecond increments The timer values remain when the input goes false.
Sets the output when the input is true and the timer is timing
Sets the output when the input is true and the accumulated value is greater then or equal to the preset value
Resets accumulated value of Timer_1
Trang 21COUNTER INSTRUCTIONS
Trang 22COUNT UP (CTU)
Use CTU to increment the accumulated value by one count
Status bit:
Trang 23CTU OPERATION
• When the accumulated value equals or exceeds the preset
value, the CTU instruction sets a done bit DN
• The accumulated value of a counter is retentive
• The count is retained until reset by a reset instruction (RES)
that has the same address as the counter
Trang 24CTU TIMING DIAGRAM
Trang 25EXAMPLE CTU
LADDER DIAGRAM
Each time the input goes from false to true, the processor increments the counter by 1
Sets the output while the counter is counting
Tells when the count is reached (ACC > or = PRE)
Reset the counter
Trang 26COUNT DOWN (CTD)
Use CTD to decrement the accumulated value by one count
Status bit:
Trang 27CTD OPERATION
• The done bit DN is set as long as the accumulated value is
greater than or equal to the preset value
• When the accumulated value is less than the preset value, the
done bit DN is reset
• The accumulated value of a counter is retentive
• When the accumulated value equals or exceeds the preset
value, the CTU instruction sets a done bit DN
• The accumulated value of a counter is retentive
• The count is retained until reset by a reset instruction (RES)
that has the same address as the counter
Trang 28CTD TIMING DIAGRAM
Trang 29EXAMPLE CTD
LADDER DIAGRAM
Each time the input goes false to true, the processor decrements the counter by 1
Sets the output while the counter is counting
Tells when the count is reached (ACC > or = PRE)
Reset the counter
Trang 30TIMER AND COUNTER RESET (RES)
The RES instruction is an output instruction that resets a timer or
counter
The RES instruction executes when its rung is true
Each time the input goes false to true, the processor decrements the counter by 1
Sets the output while the counter is counting
Tells when the count is reached (ACC > or = PRE)
Reset the counter
Trang 31Delay turning on an output TON
Delay turning off an output TOF
Trang 32DAY 2
SESSION 3
LADDER LOGIC PROGRAMMING – CONTROL
INSTRUCTIONS