4

SVCREQ #16: Read Elapsed Time Clock

Use the SVCREQ function with function number 16 in order to read the value of the system’s elapsed time clock. This clock tracks elapsed time in seconds since the PLC powered on. The timer will roll over approximately once every 100 years.

This function has an output parameter block only. The parameter block has a length of 3 words.

seconds from power on (low order)

seconds from power on (high order)

100 microsecond ticks

address

address + 1

address + 2

The first two words are the elapsed time in seconds. The last word is the number of 100 microsecond ticks in the current second.

Example:

In the following example, when internal coil %M0233 is on, the value of the elapsed time clock is read and coil %M0234 is set. When it is off, the value is read again. The difference between the values is then calculated, and the result is stored in register memory at location %R0250.

The parameter block for the first read is at %R0127; for the second read, at %R0131. The calculation ignores the number of hundred microsecond ticks and the fact that the DINT type is actually a signed value. The calculation is correct until the time since power-on reaches approximately 50 years.

 

_____

 

%M0233

%M0234

—— ———

SVC_———————————————————————————————————————————————————————————(S)—

 

REQ

 

 

CONST —FNC

 

00016

 

 

%R0127 —PARM

 

_____

 

 

 

 

 

 

 

 

 

 

_____

 

_____

 

%M0233

%M0234

 

%M0234

——/——————— ———

SVC_——————————————————

SUB_————————————————————————(R)—

 

 

 

 

REQ

DINT

 

 

 

 

CONST —FNC

%R0131 —I1

Q— %R0250

 

00016

 

 

 

 

 

%R0131 —PARM

%R0127 —I2

 

 

_____

_____

 

 

 

 

 

 

 

 

4-160

Series 90-30/20/Micro Programmable Controllers Reference Manual–September 1998

GFK-0467K

Page 241
Image 241
GE 90-30/20/Micro manual Svcreq #16 Read Elapsed Time Clock