7
Resource Usage
The AVR devices on which the ZX microcontrollers are based offer a variety of resources for use in your
program, e.g. timers, interrupts, USART (hardware serial port), analog-to-digital converters, etc. Some of
these resources are allocated to specific functions of the ZX microcontroller and/or are used by certain
ZBasic System Library routines. The resources available on a particular ZX device vary depending on
the particular CPU upon which the device is based. The table below indicates the underlying CPU for the
various ZX devices. The remainder of this section provides an overview of resource allocation for ZX
devices.
Underlying CPU Type for ZX Devices
ZX Model
CPU Type
ZX-24, ZX-40, ZX-44, ZX-24e
mega32
ZX-24a, ZX-40a, ZX-44a, ZX-24ae
mega644
ZX-24p, ZX-40p, ZX-44p, ZX-24n, ZX-40n, ZX-44n
mega644P
ZX-1280, ZX-1280n
mega1280
ZX-1281, ZX-1281n, ZX-1281e
mega1281
ZX-128e
mega128
USART
An on-board hardware serial port, or USART, is used for the Com1 serial channel. By default, the
USART is configured to operate at 19,200 baud and is utilized by the System Library Routines
reconfigure the USART to a different speed by using the System Library routine OpenCom, specifying
channel 1. The USART is also used for the ADCtoCom1 and Com1toDAC routines. In both of these
cases, the Com1 speed is automatically configured.
Some ZX devices have more than one hardware USART. In these cases, one of the USARTs is
assigned to the Com1 serial channel, a second USART is assigned to the Com2 serial channel, etc. as
shown in the table below. The effect of these assignments is generally only important with respect to
which I/O pins are available for other purposes if the additional hardware USARTs are not being used. It
also will be important if your program manipulates the USART registers directly.
Hardware USART Channel Assignment and I/O Pin Usage
ZX Model
USART
Serial Channel
Tx Pin
Rx Pin
ZX-24p, ZX-24n
USART0
Com1
1, D.1
2, D.0
USART1
Com2
11, D.3
6, D.2
ZX-40p, ZX-40n
USART0
Com1
15, D.1
14, D.0
USART1
Com2
17, D.3
16, D.2
ZX-44p, ZX-44n
USART0
Com1
10, D.1
9, D.0
USART1
Com2
12, D.3
11, D.2
ZX-1281
USART1
Com1
28, D.3
27, D.2
USART0
Com2
3, E.1
2, E.0
ZX-1280
USART0
Com1
3, E.1
2, E.0
USART1
Com2
46, D.3
45, D.2
USART2
Com7
13, H.1
12, H.0
USART3
Com8
64, J.1
63, J.0
ZX-128e, ZX-1281e
USART0
Com1
19, E.1
20, E.0
USART1
Com2
9, D.3
10, D.2
SPI Interface
On some ZX devices, your program is stored in an external EEPROM that is read and written using the
SPI interface. A dedicated I/O pin is required for selecting the EEPROM device during SPI operations
and this I/O pin cannot be used for other purposes. However, the SPI bus itself can be used to