23 of 307
ZBasic System Library 13 ZX Microcontroller Family Note, particularly, the line immediately before the call to ShiftOut(). After the semaphore is acquired Regsister.Timer1Busy will be True. Unless it is set to False, the call to ShiftOut() will fail because that subroutine will think that the timer is in use. Caution: setting the busy flag for a timer to True and neve r setting it back to False will prevent System Library routines that require that timer from functioning. Processor Speed Issues Although the standard clock speed for ZX devices is 14.7456MHz, special versions are available that run slower and faster. The table below summarizes the differences that arise due to the difference in operating speed. Processor Speed Variations Issue 7.3728MHz 14.7456MHz 18.432MHz RTC Tick Frequency 512 Hz 512 Hz 500 Hz RTC Fast Tick Frequency 512 Hz 1024 Hz 1K Hz RTC Timer Frequency 115.2 KHz 230.4 KHz 72K Hz Multi-tasking Time Slice 1.95 mS 1.95 mS 2.0 mS Default TimerSpeed1 Units 135.6 nS 67.8 nS 54.4 nS Default TimerSpeed2 Units 1.085 µS 1.085 µS* 434 nS CountTransitions() Sample Rate 204.8 KHz 409.6 KHz 512 KHz Note, particularly, that the value for TimerSpeed2 at 14.7456MHz is scaled to match the value corresponding to operating at 7.3728MHz. This is done for compatibility with BasicX devices that operate at the latter speed. Consult the preceding sections for information on which routines use the TimerSpeed1 and TimerSpeed2 values. It is highly recommended to use the built-in values Register.CPUFrequency, Register.RTCTickFrequency, and Register.RTCTimerFrequency instead of using hard-coded values. Doing so also simplifies code that must run on multiple devices that operate at different speeds. See the descriptions in the ZBasic Language Reference Manual for more details. Detailed Descriptions In the descriptions that follow, the parameter types that are accepted by each routine are described. Some parameters accept a specific fundamental data type while others may accept a few similar types. Others accept virtually any parameter type. In order to more succinctly describe the types of parameters accepted, some descriptive type categories are used. For example, the category integral is used to connote those types that have the integral characteristic, such as Byte, Integer, UnsignedInteger, Long and UnsignedLong. The table below indicates which types belong to which categories. Type Category Membership Type/Category any type integral int8/16 int16 int32 any 32-bit signed numeric Boolean x Bit x x x x Nibble x x x x Byte x x x x Integer x x x x x x UnsignedInteger x x x x x Enum x Long x x x x x x UnsignedLong x x x x x Single x x x x String x