Start Back Next End
  
ZBasic System Library
37
ZBasic Microcontrollers
Section 3 - Processor Speed and Device Configuration Issues
For ZX devices, the processor speed and configuration are fixed and specific to each device.  The clock
speed for most ATmega-based ZX devices is 14.7456MHz but special versions are available that run
slower and faster.  ZX devices based on the ATxmega run at 29.4912MHz.  The table below summarizes
the differences that arise due to the difference in operating speeds.
ZX Device Processor Speed Variations
Parameter
7.3728MHz
14.7456MHz
18.432MHz
29.4912MHz
RTC Tick Frequency
512 Hz
512 Hz
500 Hz
512 Hz
RTC Fast Tick Frequency
512 Hz
1024 Hz
1000 Hz
1024 Hz
RTC Scale Factor
1
2
2
1
RTC Timer Frequency
115.2 KHz
230.4 KHz
72 KHz
115.2 KHz
Multi-tasking Time Slice
1.95 mS
1.95 mS
2.0 mS
1.95 mS
Default TimerSpeed1 Units
135.6 nS
67.8 nS
54.4 nS
67.8 nS
Default TimerSpeed2 Units
1.085 µS
1.085 µS*
434 nS
271 nS
CountTransitions() Sample Rate
204.8 KHz
409.6 KHz
512 KHz
737.3 KHz
Note, particularly, that the “units” value for TimerSpeed2 on ZX devices running at 14.7456MHz is
scaled to match the value corresponding to operating at 7.3728MHz.  This is done for compatibility with
BasicX devices that all operate at the lower speed.  Consult the section I/O Timer Prescaler Values for
information on which routines use the TimerSpeed1 and TimerSpeed2 values.  The scaling effect
described above can be disabled by setting the value of Register.IOScaling to False.
For generic target devices, the processor speed can be any reasonable value and the RTC frequency can
be any value attainable using the available prescaler and compare value settings for the RTC timer. 
Further, the initial I/O Timer prescaler settings Register.TimerSpeed1 and Register.TimerSpeed2 can be
any useful values.  Consquently, the meaning of results returned by some ZBasic System Library routines
can only be described in terms of the value of these configurable items (all of which are specified at
compile time).
The table below gives several important values that are dependent on device configuration parameter
values both in the case of ZX devices (with fixed values) or generic target devices (with user-specified
values).   The symbols given in the table entries is used in the descriptions of various ZBasic System
Library routines thus allowing you to infer the meaning of the results based on device configuration
values.
ZBasic Device Parameters
Device Parameter
Symbol
Example
Value for ZX-24n
Main Clock Frequency
F_CPU
14.7456 MHz
RTC Scale Factor
RTC_SCALE
2
RTC Fast Tick Frequency
F_RTC_FAST
1024 Hz
RTC Tick Frequency
F_RTC_TICK
512 Hz
RTC Timer Frequency
F_RTC_TIMER
230.4 KHz
TimerSpeed1 Frequency
F_TS1
14.7456 MHz¹
TimerSpeed2 Frequency
F_TS2
1.8432 MHz²
1)
Assuming the default Register.TimerSpeed1 value of 1.
2)
Assuming the default Register.TimerSpeed2 value of 2.
Main Clock Frequency (F_CPU)
This value represents the operating speed of the target CPU.  In the case of generic target devices, it is
specified via the target device parameter ClockFrequency.
Previous page Top Next page