Navigation bar
  Start Previous page
 269 of 283 
Next page End 264 265 266 267 268 269 270 271 272 273 274  

260
UpdateRTC
Type
Subroutine
Invocation
UpdateRTC(fastTicks)
Parameter
Method
Type
Description
fastTicks
ByVal
int16
The number of fast ticks to add to the RTC.
Discussion
This subroutine can be used to update the RTC with the number of fast ticks missed during a long
operation performed with interrupts disabled.  In order to determine the number of fast ticks that are
missed, your code must periodically check the interrupt flag of the RTC timer and, if it is set, increment a
local counter value and then reset the interrupt flag.
Compatibility
This function is only available for native code targets, e.g. the ZX-24n.
Example
' This example is for the ZX-24n and other native mode devices
' that use Timer0 for the RTC timer.
Atomic
Dim missedTicks as UnsignedInteger
Const TickFlag as Byte = &H02
missedTicks = 0
Do
' place code here that performs one iteration of a
' long process and eventually exits the loop
' check the RTC flag, reset it
If (CBool(Register.TIFR0 And TickFlag)) Then
missedTicks = missedTicks + 1
Register.TIFR0 = TickFlag
End If
Loop
Call UpdateRTC(missedTicks)
Call Yield()
End Atomic
See Also
Previous page Top Next page