5-43
Interfacing AT93CXX Serial EEPROMs with AT89CX051 Microcontrollers
Serial memory devices offer significant advantages over parallel devices in applications where lower data transfer rates are A. In addition to requiring less board space, serial devices allow micro- controller I/O pins to be conserved. This is especially valuable when adding external memory to low-pin count micro- c o n t r o l l e r s s u c h a s t h e A t m e l AT89C1051 and AT89C2051.
This application note presents a suite of software routines which may be incorpo- rated into a user's application to allow AT89CX051 microcontrollers to read and write AT93CXX serial EEPROMs.
All seven AT93CXX device functions are supported: read, write, write all, erase, e r a s e a l l , e r a s e / w r i t e e n a b l e a n d erase/write disable. The routines are general purpose, supporting both eight- bit and sixteen-bit accesses to all mem- bers of the 93CXX family. In addition, both three-wire and four-wire configura- tions are supported.
The AT93CXX may be connected to the AT89CX051 microcontroller in either a
three-wire (Figure 1) or four-wire (Figure 2) configuration. In the three-wire config- uration, the EEPROM serial data in (DI) and serial data out (DO) pins are both connected to the same microcontroller I/O pin, thereby saving a pin. This is pos- sible because the microcontroller I/O pins can be dynamically reprogrammed as input or output.
Note the strapping of the AT93CXX ORG pins shown in Figure 1 and Figure 2. The ORG (internal organization) pin selects eight-bit data when grounded and sixteen-bit data when floating or tied to VCC. The ORG pin connections shown in the figures are for illustration only;
eight-bit or sixteen-bit data may be selected in either the three-wire or four- wire configuration.
The software for this application may be obtained by downloading from Atmel's BBS: (408) 436-4309. Consult the com- me nt block at th e be ginn in g of th e source code file for detailed information on features and operation.
0521A-B–12/97
8-Bit
Microcontroller with Flash
Application
Note
Microcontroller
5-44
Figure 1. Three-Wire Configuration
+ P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7
12 13 14 15 16 17 18 19
AT89CX051
P3.0/RXD P3.1/TXD P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 P3.7 2 3 6 7 8 9 11
1 RST 4
30 pF 30 pF 8.2 K 10 uF VCC
+
12 MHz
5
1 2 3 4
AT93CXX 7 6 CS
SK DI DO
DC ORG XTAL2
XTAL1
Figure 2. Typical Circuit Configuration
+ P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7
12 13 14 15 16 17 18 19
AT89CX051
P3.0/RXD P3.1/TXD P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 P3.7 2 3 6 7 8 9 11
1 RST 4
30 pF 30 pF 8.2 K 10 uF VCC
+
12 MHz
5
1 2 3 4
AT93CXX 7 6 CS
SK DI DO
DC ORG
VCC XTAL2
XTAL1