Pm designer operation manual, System service – B&B Electronics WOP-2121V-N4AE - Manual User Manual
Page 441

14
PM Designer Operation Manual
14-32
CHAPTER 14 USING MACROS
14.4.13. 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.