72 of 172
ZBasic Language Reference 65 ZX Microcontroller Family BasicX Compatibility Note In BasicX mode, only a subset of the variables described below is available, being limited to those that are also present in BasicX. Those that are available in BasicX mode are specifically identified in their descriptions. Register.ResetFlags Whenever the processor is reset, the cause of the reset is noted and stored in an internal variable that is available to user programs as Register.ResetFlags. The bits of the Byte value have the meaning shown in the table below. ResetFlags Bit Semantics Reset Source Hex Value WatchDog Reset &H08 Brown-Out Reset &H04 External Reset &H02 Power-On Reset &H01 The value of this register is set when the processor first begins executing the control program. The value is not used by the control program in any manner so you may modify it to suit the needs of your application. Note that in some circumstances, two or more of the bits in the table above may be present. Register.RTCDay Register.RTCTick These two register values (both available in BasicX compatibility mode) represent the current state of the real time clock (RTC). Register.RTCTick is a Long value that is incremented on each RTC tick (see Register.RTCTickFrequency). After 24 hours of continuous execution, it will reach its maximum value and will then roll over to zero. At the same time, the value of Register.RTCDay, type UnsignedInteger, will be incremented. Day number zero represents January 1, 1999 (for compatibility with BasicX). When the system is reset or powered up both of these values are initialized to zero. Register.RTCFastTick This Byte value changes twice as fast as Register.RTCTick (except on devices running at 7.37MHz). For most purposes, this value should be considered to be read-only. Changing it will affect the accuracy of the RTC and may interfere with normal task switching. Register.RTCStopWatch This UnsignedInteger value is incremented on each RTC tick (see Register.RTCTickFrequency), the same as Register.RTCTick. However, you may reset this value to zero at any time to facilitate simpler elapsed time calculations without affecting the RTC’s timekeeping. This register variable is available in BasicX compatibility mode. Register.RTCTickFrequency This read-only UnsignedInteger value indicates the number of RTC ticks that will occur per second. For most ZX models currently available, the RTC tick frequency is 512Hz.