Differences Between Time and Timer Data Types in Siemens PLC

Core Difference: Time is a data type used to store time values (e.g., 10 seconds); Timer is a functional component used to implement timing logic (e.g., triggering an action after a delay of 10 seconds). Essentially, it is a “device that works with Time values.”

The specific differences can be quickly distinguished by two points:

1. Essential Attributes:

Time: Represents only a “quantity of time,” similar to how “length is stored as Int”; time is stored as Time, with no logical functionality.

Timer: Acts as a “timing relay” within the PLC, equipped with timing, reset, trigger, and other logic, requiring a configured Time type setting to function.

2. Usage Scenarios:

Using Time: When you need to record or pass a time value, for example, “the motor has run for 30 seconds,” you would store 30 seconds in the variable as Time#30s.

Using Timer: When you need to implement delay control, for example, “after pressing the button, delay for 5 seconds before turning on the light,” you would call the Timer and set it with the parameter Time#5s.

Example

Taking the Siemens S7-200 SMART PLC’s TON (On Delay Timer) as an example, the specific program configuration and timing logic are as follows, with the core being to associate the Time value (e.g., 5 seconds) with the timer’s “preset value” parameter. 1. Key Parameter Definitions First, clarify the three core parameters of the TON timer, where the Time value is written through the “preset value”: – EN (Enable): Connects to the trigger signal (e.g., button, sensor signal); when ON, the timer starts counting. – PT (Preset Value): Sets the target timing duration, which must be filled in the Time format supported by the PLC (e.g., T37 timer has a unit of 100ms, so 5 seconds should be set to 50). – Q (Output): When the timing reaches the PT value, Q changes from OFF to ON, triggering subsequent actions (e.g., lighting an indicator lamp, starting a motor). 2. Specific Program Example (Ladder Diagram) Assume the requirement: Press button I0.0, and after 5 seconds, light up indicator Q0.0. 1. First Step: Configure the trigger signal by connecting the button input signal I0.0 to the EN terminal of the TON timer (e.g., T37); when I0.0 is pressed, T37 starts counting. 2. Second Step: Set the Time value to the PT terminal; since T37 is a 100ms timer (fixed unit), 5 seconds = 50×100ms, so set the PT value to 50 (input the number directly, and the PLC automatically recognizes it as the corresponding Time value). 3. Third Step: Associate the output action by connecting the Q terminal of T37 to the indicator lamp output Q0.0; when T37 counts to 5 seconds (current value = PT value 50), the Q terminal becomes ON, and Q0.0 lights up. 3. Operating Logic – Not pressing I0.0: EN=OFF, T37 does not count, current value=0, Q=OFF, Q0.0 does not light. – Pressing I0.0: EN=ON, T37 current value starts incrementing from 0 (every 100ms +1). – After counting 5 seconds: current value=50 (equal to PT value), Q=ON, Q0.0 lights up; after releasing I0.0, EN=OFF, T37 resets (current value=0, Q=OFF).

Leave a Comment