ZBasic System Library
13
ZX Microcontroller Family
PORTE_INT1
ACA_AC0
ACA_AC1
ACA_ACW
ACB_AC0
ACB_AC1
ACB_ACW
PORTE_INT1
PORTF_INT0
PORTF_INT1
PORTH_INT0
PORTH_INT1
PORTJ_INT0
PORTJ_INT1
PORTK_INT0
PORTK_INT1
PORTQ_INT0
PORTQ_INT1
ACA_AC0
ACA_AC1
ACA_ACW
ACB_AC0
ACB_AC1
ACB_ACW
Timers
ZX devices have three or more timers, depending on the underlying CPU type, that are used for various
purposes. One of the timers is used to implement the real time clock (RTC), another is used for the
software-based serial ports and a third timer is used to provide the precise timing required for certain I/O
routines. The specific timer that is used for a particular function varies depending on the underlying CPU
type as shown in the table below.
Timer Usage by CPU Type
Underlying CPU
RTC
I/O
Serial
16-bit PWM
InputCapture OutputCapture
mega32, mega328P,
mega644, mega644P
Timer0
Timer1
Timer2
Timer1
Timer1
Timer1
mega1284P
Timer0
Timer3
Timer2
Timer1
Timer3
Timer1
Timer3
Timer1
Timer3
mega128
Timer0
Timer1
Timer2
Timer1
Timer3
Timer1
Timer3
Timer1
Timer3
mega1281
Timer2
Timer4
Timer0
Timer1
Timer3
Timer1
Timer3
Timer1
Timer3
mega1280
Timer2
Timer4
Timer0
Timer1
Timer3
Timer4
Timer5
Timer1
Timer3
Timer4
Timer5
Timer1
Timer3
Timer4
Timer5
xmega32A4
TimerC1
TimerE0
TimerD1
TimerC0
TimerD0
TimerD1
TimerE0
TimerC0
TimerD0
TimerD1
TimerE0
TimerC0
TimerD0
TimerD1
TimerE0
xmega128A1
TimerC1
TimerF1
TimerD1
TimerC0
TimerD0
TimerD1
TimerE0
TimerE1
TimerF0
TimerF1
TimerC0
TimerD0
TimerD1
TimerE0
TimerE1
TimerF0
TimerF1
TimerC0
TimerD0
TimerD1
TimerE0
TimerE1
TimerF0
TimerF1
The RTC Timer is programmed to generate an interrupt that is used to update the RTC and to trigger task
switching. Because its role is so central, the RTC Timer cannot be used for any other purpose. The I/O
Timer is used by several I/O related routines as explained in more detail below. The Serial Timer is used
to generate interrupts to implement the timing required for serial channels Com3 to Com6. If none of the
channels 3-6 is open, the Serial Port Timer can be used for other purposes in your program. Timers are