下载
© 2005 Microchip Technology Inc. DS00982A-page 1
AN982
INTRODUCTION
The 24LCXXB Serial EEPROMs from Microchip
Technology are I
2
C
™
compatible and support both the
standard 100 kHz and the 400 kHz Fast mode. Many
times when designing an application which utilizes a
serial EEPROM device, it may be beneficial to use a
microcontroller which does not feature a dedicated
protocol-specific serial port. This is due to several
possible reasons, including size restrictions or costs. In
these instances, the designer is required to write
software routines capable of generating the proper
signals for communicating with the EEPROM device.
This application note is intended to serve as a
reference for manually communicating with Microchip’s
24LCXXB serial EEPROM devices; that is, without
relying on a hardware serial port to handle the I
2
C
operations. Also, the advantages of each I
2
C operation
are discussed and compared. Source code for
common data transfer modes is also provided.
The included firmware supports both the PIC10F202
and the PIC12F675 PICmicro
®
microcontrollers.
Conditional assembly is implemented to account for the
small differences between the two processors.
Figure 1 describes the hardware schematic for the
interface between Microchip’s 24LCXXB devices and
the PIC10F202 microcontroller, and Figure 2 shows
the schematic for the PIC12F675. The schematics
show the connections necessary between each micro-
controller and the serial EEPROM as tested, and the
software was written assuming these connections. The
SDA pin is an open-drain terminal and therefore,
requires a pull-up resistor to V
CC (typically 10 kΩ for
100 kHz and 2 kΩ for 400 kHz). Also, the WP pin is tied
to ground, because the write-protect feature is not used
in the examples provided.
FIGURE 1: CIRCUIT FOR PIC10F202 AND 24LCXXB DEVICES
Author: Chris Parris
Microchip Technology Inc.
SOT-23
Note 1: SDA requires a pull-up resistor (10 kΩ for 100 kHz, 2 kΩ for 400 kHz)
VCC
16
4
3
GP0
V
SS
GP1
25
GP3/MCLR
VCC
GP2
PIC10F202
(6-PIN)
SOT-23
15
4
3
SCL
V
SS
SDA
(1)
2
WP
V
CC
24LCXXB
(5-PIN)
10K 10K
Interfacing I
2
C™ Serial EEPROMs to PIC10 and PIC12 Devices