Svc_Req 16: Read Elapsed Time Clock - GE PACSystems RX7i Cpu Programmer's Reference Manual

Hide thumbs Also See for PACSystems RX7i:
Table of Contents

Advertisement

Chapter 6. Service Request Function

6.17 SVC_REQ 16: Read Elapsed Time Clock

Use SVC_REQ 16 to read the system's elapsed time clock. The elapsed time clock measures the time
in seconds since the CPU was powered on. The parameter block has a length of three words used for
output only.
Output
Address
Seconds from power on (low order)
Address+1 Seconds from power on (high order)
Address+2 100 microsecond (µs) ticks
The first two words are the elapsed time in seconds. The last word is the number of 100 µs ticks in
the current second.
The resolution of the CPU's elapsed time clock is 100 microseconds (µs). The overall accuracy of the
elapsed time clock is ±0.01%. The accuracy of an individual sample of the elapsed time clock is
approximately 105 µs.
SVC_REQ 16 Example
The following logic is used in a block that is called infrequently. The screen shot was taken between
calls to the block. The logic displayed calculates the number of seconds that have elapsed since the
last time the block was called. It performs the final operation on rung 4 by subtracting the time
obtained by SVC_REQ 16 the last time the block was called (vetum) from the time currently obtained
by SVC_REQ 16 (novum) and storing the calculated value in the variable named diff.
On rung 2, SVC_REQ 16 returns three WORDs, stored in the 3-WORD array tempus. The first two
WORDs (16-bit values) are moved to a DINT (a 32-bit value). This move amounts to a rough data type
conversion that ignores the fact that the DINT type is actually a signed value. Despite that, the
subsequent calculations are correct until the time since power-on reaches approximately 50 years.
The DINT is converted to REAL to yield the number of whole seconds elapsed since power-on, stored
in variable sec. On rung 3, the third word returned by SVC_REQ 16, tempus[2], is converted to REAL.
This is the number of 100 µs ticks. To obtain a fraction of a second, stored in the variable fractio, the
value is divided by 10,000. On rung 4, sec and fractio are added to express the exact number of
seconds elapsed since power-on, and this value is stored in the variable novum. On rung 1, the
previous value of novum was saved as vetum, the exact number of seconds elapsed since power-on
the last time the block was called. The last instruction on the fourth rung subtracts vetum from
novum to yield the number of seconds that have elapsed since the last time the block was called.
304
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
The SVC_REQ instruction is not protected against
operating system and user interrupts. The timing and
length of these interrupts are unpredictable. The clock
sample returned by SVC_REQ 16 can sometimes be
much more than 105 µs old by the time execution is
returned to the LD logic.
Warning
GFK-2950C

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Table of Contents