Siemens s7-200PLC timer

Siemens s7-200PLC timer

  The timer is one of the commonly used components in the PLC. The timer value should be preset when in use. When the input condition of the timer is met during the operation, the current value will be installed from 0 to increase by a certain unit. When the current timer is When the value reaches the set value, the timer starts to act to meet the needs of various timing logic control.

basic concepts

Resolution

  The time increment per unit time is called the resolution of the timer. S7-200PLC has three resolution levels: 1ms, 10ms and 100ms.

Timing

  T (timing time) = set value (PT) 1 * resolution

Timer number

  Contains timer bit and timer current value
  Timer bit: when the current value of the timer reaches the set value (PT), the timer's contact action
  timer current value: stores the current accumulated time of the timer, using 16 bits Signed integer representation, the maximum count value is 32767 (that is, 2 to the 15th power -1)

Timer instruction

Write picture description here

On-delay timer (TON)

  When the current value starts counting from 0, the timer bit is OFF. When the current value reaches the set value, the timer bit is ON, and the current value continues to count to 32767. During this period, the timer bit is always ON. After disconnection, the timer is automatically reset, that is, the timer bit is OFF, and the current value is 0.

Memory on-delay (TONR)

  Its logical structure is the same as the on-delay timer, but when the current value is timing, if an interrupt occurs, and when the timing is restarted, the current value will continue to count from the value before the interruption, until it counts to 32767. And the TONR timer only It can be reset by the reset command R.

Off-delay timer (TOF)

  It is used to count a single time after power-off. When the power-on cycle or the first scan, the timer bit is OFF and the current value is 0. After the input is turned on, the timer bit is ON and the current value is 0. When the input terminal is connected by When it is turned off, the timer starts timing. When the set value is reached, the timer bit is OFF and the timing stops.

Application examples

Write picture description here

Timer usage rules

Refresh method

1ms

  The 1ms timer is refreshed by the system every 1ms. It has nothing to do with the scan cycle and program processing. It uses the interrupt refresh method. Therefore, when the scan cycle is greater than 1ms, it may be refreshed multiple times in a cycle, and its current value is It is not necessarily consistent within a scan cycle.

10ms

  The 10ms timer is automatically refreshed by the system at the beginning of each scan period. Because it is refreshed every scan period value, the timer bit and the current value of the timer remain unchanged during a scan period.

100ms

  The 100ms timer is refreshed when the timer instruction is executed. Therefore, if the 100ms timer is activated, if the timer instruction is not executed every scan cycle or the timer instruction is executed multiple times in a scan cycle, it will cause timing failure. quasi.

Precautions

Write picture description here


  1. The data type of PT is INT, and the operands can be: VW, IW, QW, MW, SW, SMW, LW, AIW, T, C, AC, *VD, *AC, *LD, etc., among which constants are the most common

Guess you like

Origin blog.csdn.net/yue008/article/details/72303290