TSL Automation Solutions Logo

Section 15.4.9 · Chapter 15: Using Macros

Timer Operation

■ SET_T

Format SET_T(P1,P2) Data Type U
Function Starts the timer P1 using the timer control block in P2.
P1 (C) The ID of the timer. There are 8 timers available and the IDs are 0 to 7. Those models that are based on Windows, WinCE, and ARM11 CPU have extra 4 timers and the IDs are 8 to 11.
P2 (I) The starting location of the memory block (or word array) that is used as a Timer Control Block for the timer. The structure of the Timer Control Block is shown below:
Word No. Data Item Description
0 Type of operation 0:One-shot; 1: Square-wave; 2: One-shot with continuous timing; 3: Square-wave with bits rotating
1 Current timer value If the timer’s ID is between 0 and 7, it increases the current timer value by 1 every 100 milliseconds; otherwise it increases the current timer value by 1 every 10 milliseconds.
2 Timer limit When the current timer value reaches the timer limit, the timer will perform one of the following operations according to the type of operation:
1) If the type of operation is 0 (One-shot), sets the time-up flag to 1, resets the current timer value to 0, and stops itself.
2) If the type of operation is 1 (Square-wave), toggles the time-up flag, resets the current timer value to 0, and continues the timing operation.
3) If the type of operation is 2 (One-shot with continuous timing), sets the time-up flag to 1 and continues the timing operation. The timer will stop itself when the current timer value reaches 65535.
4) If the type of operation is 3 (Square-wave with bits rotating), toggles the time-up flag, resets the current timer value to 0, rotates the specified bits left, and continues the timing operation.
3 Time-up flag This word will be set to 0 or 1 when the current timer value is equal to the timer limit.
4 Number of bits The number of bits to be rotated. The maximum is 32. The word is required only for operation type 3 (Square-wave with bits rotating).
For example, when the number of bits is 24, the rotation will work on bit 0 through bit 23 and keep bit 25 through bit 31 intact. Each rotation will shift bit 0 through bit 22 left and rotates bit 23 to bit 0.
5 Bits 0 to 15 The word contains bit 0 through bit 15 of the rotate operation. The word is required only for operation type 3.
6 Bits 16 to 31 The word contains bit 16 through bit 31 of the rotate operation. The word is required only for operation type 3 with more than 16 bits to be rotated.
The timer will use the associated Timer Control Block as its private memory, so do not use any words in the block for other purposes.
A Timer Control Block may require 4, 6, or 7 words.
Example 1 $U100 = 1 /* Type of operation is Square-wave. */
$U101 = 0 /* Initialize the current timer value to 0. */
$U102 = 5 /* Timer limit is 0.5 second (5*100ms). */
$U103 = 0 /* Initialize the time-up flag to 0. */
SET_T(3, $U100) /* Use timer #3 to generate a 1 Hz square wave on $U103.0 */

■ STOP_T

Format STOP_T(P1) Data Type U
Function Stops the timer P1.
P1 (C) The ID of the timer.
Example 1 STOP_T(1) /* Stop timer #1 */

■ WAIT_T

Format WAIT_T(P1) Data Type U
Function Waits for the time-up of timer P1. The macro command following this one will not be executed until the timer reaches its limit.
P1 (C) The ID of the timer.
Example 1 $U100 = 0 /* Type of operation is One-shot. */
$U101 = 0 /* Initialize the current timer value to 0. */
$U102 = 5 /* Timer limit is 0.5 second (5*100ms). */
$U103 = 0 /* Initialize the time-up flag to 0. */
SET_T(7, $U100) /* Starts timer #7 as a 0.5 second timer. */
WAIT_T(7) /* Wait 0.5 second */

Need PM Designer itself?

V4 for current PK, PT, ITV and PM panels, V2 for older models. Free, sent by email.

Source.Section 15.4.9 of the PM Designer Software User Manual, Edition 2.0, © Cermate Technologies Inc. (www.cermate.com, service@cermate.com). Reproduced online, with the manual's own figures, by TSL Automation Solutions, authorised Cermate distributor, for users of Cermate HMI panels. PM Designer and PanelMaster are trademarks of Cermate Technologies Inc.

Text and figures are the manufacturer's and may describe features your panel or software version does not have. For a plain-language introduction read the PM Designer guide; for help with a specific panel contact TSL Automation.