TSL Automation Solutions Logo

Section 15.4.14 · Chapter 15: Using Macros

System Service

■ GET_RTC

Format GET_RTC(P1 ) Data Type U
Function Gets the data of the real time clock and saves the result in P1.
P1 (I) The starting location of the memory block that is used as an RTC data block to receive the operation result. The structure of the RTC data block is shown below:
Data Item Data Type/Size Word No.
Second 16-bit Unsigned Integer 0
Minute 16-bit Unsigned Integer 1
Hour 16-bit Unsigned Integer 2
RTC adjustment 16-bit Signed Integer 3
Day 16-bit Unsigned Integer 4
Month 16-bit Unsigned Integer 5
Year 16-bit Unsigned Integer 6
Day of week 16-bit Unsigned Integer 7
Second: 0-59; Minute: 0-59; Hour: 0-23; RTC adjustment: -63-63; Day: 1-31; Month: 1-12; Year: 0(2000)-99(2099); Day of week: 0(Sunday)-6(Saturday)
An RTC data block requires 8 words.
Example 1 GET_RTC($U100) /* Get the data of the real time clock. The second will be in $U100 and the day-of-week will be in $U107. */

■ SET_RTC

Format SET_RTC(P1 ) Data Type U
Function Sets the real time clock using the data in P1.
P1 (I) The starting location of the memory block that is used as an RTC data block to contain the new settings for the real time clock. See the description of GET_RTC to know the structure of the RTC data block.
Example 1 $U100 = 0 // Second
$U101 = 30 // Minute
$U102 = 8 // Hour
$U103 = 0 // Adjustment
$U104 = 1 // Day
$U105 = 7 // July
$U106 = 10 // Year 2010
$U107 = 4 // Thursday
SET_RTC($U100) /* Set the real time clock to 8:30:00 July 1st 2010 Thursday */

■ SYS

Format SYS(P1,P2,P3) Data Type U
Function Requests system service P1 with the arguments P2 and P3. This command is reserved for system use.
P1 (I) The code of the system service.
P2,P3 (I/C) The arguments of the system service.
Example 1 SYS(0x6630, 0, 0) /* Restart the application */
Example 2 SYS(0x6631, 0, 0) /* Run Panel Setup */
Example 3 Generate a random number. The random number generation starts from a seed value, so you must do initialization first.
SYS(0x63A1,0,0) /* Initialize a seed value for a random number. */
SYS(0x63A2,0,0) /* Generate a random number and save it into $S521*/
W220 = $S521%255 + 1(S) // Get a random number between 1 and 256
Example 4 Calculate the relative humidity with given temperatures of dry bulb and dew point, please see 15.4.14.1 Calculating Relative Humidity.htm for details
$U200 = 70 (F) // Set the dry bulb temperature in Celsius
$U202 = 65 (F) // Set the dew point temperature in Celsius SYS(31,1,$U200) // Calculate the relative humidity
// The result is saved in $U204 and $U205 and should be 80.2547

■ SetBacklight

Format SetBacklight(P1) Data Type U
Function Switches the LCD backlight.
P1 (I/C) Specifies the switch operation.
P1 Operation
0 Turns off the backlight
1 Turns on the backlight
Example SetBacklight(0) /* Turn off the backlight. */

■ SetScreenSaver

Format SetScreenSaver(P1) Data Type U
Function Sets the wait time of the screen saver.
P1 (I/C) The wait time. The time unit is minute. The screen saver is disabled when the wait time is 0
Example SetScreenSaver(20) /* Set the wait time of the screen saver to 20 minutes. */

■ SetIdleProc

Format SetIdleProc(P1,P2) Data Type U
Function Sets the properties of the idle processing.
P1 (I/C) Specifies the setting operation
P1 Operation
0 Resets all properties to the original settings.
1 Sets the idle time.
2 Sets the idle screen.
3 Sets the user level.
P2 (I/C) Specifies the property of the designated operation.
P1 P2
0 0
1 The idle time. The time unit is minute. The idle processing is disabled when the idle time is 0.
2 The idle screen number. The HMI will display the idle screen when it enters in the idle mode. Set P2 to 0 if no idle screen is to display.
3 The user level that the HMI will change to when it enters in the idle mode. A valid user level is between 0 and 8. Set P2 to 255 if changing user level is not required.
Example SetIdleProc(2, 10) /* Set the idle screen to screen No. 10. */

■ GetID

Format P1 = GetID(P2) Data Type U
Function Gets P2 type of the identifier of the HMI unit and saves the result starting from P1.
P1 (I) The starting location of the memory block to save the identifier.

Two kinds of data can be used as the identifier of an HMI unit, which are the product serial number and the MAC address of an Ethernet port. The required sizes of memory to save the two kinds of identifiers are different. The product serial number needs seven words because the serial number is a string with 14 characters. The MAC address needs six words because the address is composed of 6 numbers.
P2 (I/C) The type of the identifier.
The following table describes the type codes and the supporting HMI models:
Type Code Type of identifier Supporting models
0 Product serial number T Series HMI
1 MAC address of the first Ethernet port T Series HMI; The HMI Runtime
2 MAC address of the second Ethernet port The HMI Runtime
Example $U100 = GetID(0) /* Get the HMI’s serial number. The result is saved in $U100-$U106 */

$U110 = “07WT4DX1130118”

$U120 = STRNCMP($U100, $U110, 14) /* Set $U120 to 0 if the identifier is 07WT4DX1130118 */

■ SetBrightness

Format SetBrightness(P1 ) Data Type U
Function Sets the brightness of the LCD.
P1 (I/C) Specifies the brightness level. A valid level is between 0 and 15. Level 0 is the darkest and level 15 is the brightest.

■ SetBriRange

Format SetBriRange(P1,P2) Data Type U
Function Sets the adjustable range of the LCD brightness. The range is determined by two values: the darkest percentage and the brightest percentage.
P1 (I/C) Specifies the darkest percentage which is the percentage of the least brightness that is allowed to set to the full brightness of the display. A valid value is between 0 and 99 and must be less than the brightest percentage.
P2 (I/C) Specifies the brightest percentage which is the percentage of the most brightness that is allowed to set to the full brightness of the display. A valid value is between 1 and 100 and must be greater than the darkest percentage.
Example SetBriRange(10, 85) /* The adjustable range is between 10% and 85% of the full brightness when the darkest percentage and the brightest percentage are 10 and 85 respectively. */

In this section

  1. 15.4.14.1Calculating Relative Humidity

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.14 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.