Chapter 6. Service Request Function304 PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C6.17 SVC_REQ 16: Read Elapsed Time ClockUse SVC_REQ 16 to read the system's elapsed time clock. The elapsed time clock measures the timein seconds since the CPU was powered on. The parameter block has a length of three words used foroutput only.OutputAddress Seconds from power on (low order)Address+1 Seconds from power on (high order)Address+2 100 microsecond (μs) ticksThe first two words are the elapsed time in seconds. The last word is the number of 100 μs ticks inthe current second.The resolution of the CPU's elapsed time clock is 100 microseconds (μs). The overall accuracy of theelapsed time clock is ±0.01%. The accuracy of an individual sample of the elapsed time clock isapproximately 105 μs.WarningThe SVC_REQ instruction is not protected againstoperating system and user interrupts. The timing andlength of these interrupts are unpredictable. The clocksample returned by SVC_REQ 16 can sometimes bemuch more than 105 μs old by the time execution isreturned to the LD logic.SVC_REQ 16 ExampleThe following logic is used in a block that is called infrequently. The screen shot was taken betweencalls to the block. The logic displayed calculates the number of seconds that have elapsed since thelast time the block was called. It performs the final operation on rung 4 by subtracting the timeobtained by SVC_REQ 16 the last time the block was called (vetum) from the time currently obtainedby 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 twoWORDs (16-bit values) are moved to a DINT (a 32-bit value). This move amounts to a rough data typeconversion that ignores the fact that the DINT type is actually a signed value. Despite that, thesubsequent 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, storedin 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, thevalue is divided by 10,000. On rung 4, sec and fractio are added to express the exact number ofseconds elapsed since power-on, and this value is stored in the variable novum. On rung 1, theprevious value of novum was saved as vetum, the exact number of seconds elapsed since power-onthe last time the block was called. The last instruction on the fourth rung subtracts vetum fromnovum to yield the number of seconds that have elapsed since the last time the block was called.