en-us_products:mpino_studio2:box_functions:timer

This is an old revision of the document!


MPINO STUDIO 2 Phase 4-1 · Timer Box Functions

These commands create a completion state from an input condition and elapsed time.

These commands create a completion state from an input condition and elapsed time.

Common Rules

The TON family uses a 10 ms tick and the TAON family a 100 ms tick by default; you can change these units for each project in Timer Unit Settings. A number is a tick count, and time literals such as 1h30m, 10s, and 500ms are accepted. If you enter a memory address such as D10 as the preset, you can change the time while running, for example from an HMI (Set the Preset from Memory). Use T for a 16-bit timer and DT for a 32-bit timer. A bit contact for the timer address reads its done state. Initialize a retentive timer with a ladder RESET coil, not box-function RST.

Timer current value and done state

Box Function List

Command Meaning
TON Accumulates time while the input is ON and turns the done state ON at the set value.
TOFF Turns the done state ON immediately with the input.
TPL Turns the done state ON when the input changes to ON.
TMON Starts one pulse when the input turns ON and holds the done state ON for the set time.
TMR Accumulates time while the input is ON.
TAON Provides the same on-delay behavior as TON with a default 100 ms tick.
TAOFF Provides the same off-delay behavior as TOFF with a default 100 ms tick.
TAPL Provides the same input-held pulse behavior as TPL with a default 100 ms tick.
TAMON Provides the same one-shot pulse behavior as TMON with a default 100 ms tick.
TAMR Provides the same retentive behavior as TMR with a default 100 ms tick.

Timer Unit Settings

The length of one timer tick is set for each project. Open Settings → Memory Area Settings (Ctrl + Shift + M) and choose the values under Timer units at the bottom of the window. The selected values are saved in the project (.mp2).

Item Box functions affected Available values Default
T* timer unit TON, TOFF, TPL, TMON, and TMR 1 ms / 10 ms 10 ms
TA* timer unit TAON, TAOFF, TAPL, TAMON, and TAMR 10 ms / 100 ms / 1000 ms 100 ms

The TA* unit must be larger than the T* unit. For example, if T* is 10 ms, you must choose 100 ms or more for TA*. If the two values are the same, a warning appears and the settings cannot be saved.

Changing the unit affects presets as follows.

  • A preset entered as a number is a tick count. TON T0 100 is 1 second with the default settings and 0.1 seconds after T* is changed to 1 ms.
  • A preset entered with a time unit, such as 1s or 500ms, keeps the same time with any setting. However, it causes a build error if it is not a multiple of the new unit (15ms with a 10 ms unit) or exceeds the maximum tick count.
  • The maximum time scales with the unit. T (16-bit) holds up to 65535 ticks, so with T* set to 1 ms it covers about 65 seconds. For longer times, use a TA* timer or a 32-bit DT.
  • In a project that does not use the default units, the actual time appears below a numeric preset. For example, in a project with T* set to 1 ms, TON T0 100 shows 100ms.

If you change the unit and save while timers are affected, the Change timer units window opens and shows how many box functions change and where they are in the ladder.

Button Action
Convert numbers, keep the time Converts numeric presets to the new unit so that the time stays the same. Example: changing from 10 ms to 1 ms turns TON T0 100 into TON T0 1000
Keep numbers (time changes) Leaves the numbers as entered and changes only the unit. The time of numeric presets changes.
Cancel Does not change the unit.
Caution when changing the unit: Comparison contacts such as T0 > 50, MOV T0 D0, T[0] in Arduino code, the current values in the Modbus 4000 range, the value in D10 of TON T0 D10, and T values saved on the board by power-fail retention are tick counts, so they do not change automatically when the unit changes. Check these values yourself after changing the unit. Changing the unit also clears the ladder undo history.
Note on the 1 ms unit: 1 ms is the unit of measurement, not the accuracy. Completion is checked once per scan, so the actual completion can be late by about the scan time plus 1 ms.
Caution for earlier versions: A project whose timer units differ from the defaults (T* 10 ms, TA* 100 ms) cannot be opened in an earlier version without this feature.

Set the Preset from Memory

If you enter a memory address such as D10 in the preset field instead of a number or time, the timer reads that memory's value as the preset on every scan. You can change the timer's time from an HMI (touch panel) or through communication by changing the memory value, without uploading the program again. The same rule applies to all 10 timers, whether the target is T or DT.

Type Addresses you can use Example
WORD memory D, C, T, WP, WM TON T0 D10, TON T0 WM1
DWORD memory DD, DC, DT, DP, DM TON DT0 DD5
Symbol A symbol that points to one of the addresses above TON T0 Speed (when Speed points to D10)

Real numbers (R), bits (M0, D0.5, WM0.3), 8-bit views (BM0), Arduino variables, expressions (D10+1), and addresses outside the memory range cannot be used and cause a build error. T0 in the preset field reads the current value, not the done state.

Run condition Memory value Command entered Expected result
Left condition ON D10=300 TON T0 D10 3 s later (default unit) → T0 done contact=ON
Left condition ON D10=500 TON T0 D10 5 s later (default unit) → T0 done contact=ON
Caution on memory values: A memory value is a tick count, not a time. With the default units, TON T0 D10 runs for 5 seconds when D10 is 500, and TAON T0 D10 runs for 5 seconds when D10 is 50. If you change the timer units, the same value gives a different time; the value in memory does not change automatically and is not converted by the Change timer units window. Check the values the HMI uses yourself after changing the unit.
  • A change made while running takes effect immediately. Raising the value during timing continues counting up to the new value; lowering it below the current value ends the timer on the next scan.
  • TON and TMR stay done even if the value is raised after completion. To time again from the start, turn the TON input OFF and then ON, and initialize TMR with a ladder RESET coil.
  • If the value is 0, TON and TMR complete as soon as the input turns ON, and TOFF turns its done state OFF as soon as the input turns OFF. TPL and TMON end in the same scan, so their ON state is not visible.
  • The value is read as unsigned. A value shown as -1 in monitoring is 65535 ticks. When a T target uses DWORD memory, a value larger than 65535 is also treated as 65535 ticks.
  • A DWORD address in the preset field follows the rule in Memory Structure: DD5 is D10 and D11. This differs from the DT numbering rule for the target.
Caution right after power-on: The memory value is 0 until the HMI writes it, so during that time TON completes immediately and TPL and TMON produce no output. To keep the value through a power cycle, register that memory in EEPROM Retain (Ctrl + Shift + E).
en-us_products/mpino_studio2/box_functions/timer.1794497224.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki