Start Back Next End
  
ZBasic System Library
8
ZBasic Microcontrollers
UARTs
An on-board hardware serial port, (UART, USART, or LIN/UART), is used for the Com1 serial channel (if
available).  By default, the UART is configured to operate at 19,200 baud and is utilized by the System
Library Routines Console.Read, Console.ReadLine, Console.Write, Console.WriteLine and Debug.Print.
You may set the console to a different initial speed using the compiler directive Option ConsoleSpeed
(described in the ZBasic Language Reference Manual).  You may also reconfigure the UART to a
different speed by using the System Library routine OpenCom, specifying the console channel.  The
UART is also used for the ADCtoCom1 and Com1toDAC routines (available only on ATmega-based ZX
devices).  In both of these cases, the Com1 speed is automatically configured.
Some target devices have multiple hardware UARTs.  In these cases, one of the UARTs is assigned to
the Com1 serial channel, another UART is assigned to the Com2 serial channel, etc. as shown in the
tables 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 UART registers directly.
It is important to note that on the ZX-24p, ZX-24n, ZX-24r and ZX-24s, the Com2 serial channel cannot
be used at the same time as the hardware I2C channel because the pin 11 is shared between the TxD
pin of Com2 and the SDA signal.
Hardware UART Channel Assignment and I/O Pin Usage for ZX Devices
ZX Device
UART
Channel
Tx Pin
Rx Pin
ZX-24, ZX-24a
USART0
Com1¹
1, D.1
2, D.0
ZX-24p, ZX-24n, ZX-24r, ZX-24s, ZX-24t
USART0
Com1¹
1, D.1
2, D.0
USART1
Com2
11, D.3
6, D.2
ZX-40, ZX-40a
USART0
Com1
15, D.1
14, D.0
ZX-40p, ZX-40n, ZX-40r, ZX-40s, ZX-40t
USART0
Com1
15, D.1
14, D.0
USART1
Com2
17, D.3
16, D.2
ZX-44, ZX-44a
USART0
Com1
10, D.1
9, D.0
ZX-44p, ZX-44n, ZX-44r, ZX-44s, ZX-44t
USART0
Com1
10, D.1
9, D.0
USART1
Com2
12, D.3
11, D.2
ZX-328n, ZX-328l
USART0
Com1
3, D.1
2, D.0
ZX-32n, ZX-32l
USART0
Com1
31, D.1
30, D.0
ZX-1281, ZX-1281n
USART1
Com1
28, D.3
27, D.2
USART0
Com2
3, E.1
2, E.0
ZX-1280, ZX-1280n
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-24x, ZX-24u
USARTD0
Com1¹
1, D.3
2, D.2
USARTD1
Com2
D.7
D.6
USARTC0
Com7
9, C.3
10, C.2
USARTC1
Com8
5, C.7
6, C.6
USARTE0
Com9
19, E.3
18, E.2
ZX-32a4, ZX-128a4u
USARTD0
Com1
23, D.3
22, D.2
USARTD1
Com2
27, D.7
26, D.6
USARTC0
Com7
13, C.3
12, C.2
USARTC1
Com8
17, C.7
16, C.6
USARTE0
Com9
33, E.3
32, E.2
ZX-128a1
USARTD0
Com1
28, D.3
27, D.2
USARTD1
Com2
32, D.7
31, D.6
USARTC0
Com7
18, C.3
17, C.2
USARTC1
Com8
22, C.7
21, C.6
USARTE0
Com9
38, E.3
37, E.2
USARTE1
Com10
42, E.7
41, E.6
USARTF0
Com11
48, F.3
47, F.2
USARTF1
Com12
52, F.7
51, F.6
Previous page Top Next page