Categories: Hookup Guide-PIC

OpenLab EEPROM Hookup Guide

EEPROM stands for electrically erasable programmable read-only memory. As the name suggests, it’s content can be programmed and erased with the help of suitable electric pulses. It is a non-volatile memory used in computers and other electronic devices to store a relatively small amount of data but allows individual bytes to be erased and reprogrammed. EEPROM retains its data even when the power is off. EEPROM memory is widely used in microcontroller based systems in which data need to be stored when the power is turned off, also when a particular data need to be retained when the power is switched on. EEPROM ICs communicate with the microcontroller through serial communication protocols such as I2C, SPI, and UART.

EEPROM Pinout

OpenLab uses AT24C16A EEPROM IC. It is interfaced with the microcontroller through an I2C protocol. Processes such as data writing, reading and initialization are carried out through an I2C interface. Below diagram shows the pinout of AT24C16A.

A0, A1, A2 are address lines, VCC and GND are power supply lines, SCL and SDA are clock and data lines respectively for an I2C protocol. A0, A1 and A2 lines are used for memory page addressing in case of 16K EEPROM while they are used for device addressing in other cases. WP is write protect pin which provides hardware write protection.

I2C Protocol

I2C is a serial communication protocol developed by Philips. I2C involves half duplex synchronous serial communication. The main advantage of I2C over other communication protocols is that number of devices can be connected. In I2C protocol, the device which generates the clock frequency is termed as master and all other devices which receive the clock are called slaves. The master device supplies the clock through SCL line and data transfer is carried out through SDA.

The above block diagram shows a typical I2C network in which A, B, and C are slave devices connected to I2C bus. SCL and SDA lines need to be pulled up to VCC because both lines are in open drain state.

Each I2C slave device has a unique 7-bit address. The communication is initiated by the master device. Master generates a start condition and sends the 7-bit slave address with last bit 0 or 1. All the devices in the I2C bus will compare the received address with its device address. The slave which matches the address will generate an acknowledgment. If the last bit of the data is 0, then it will be written to the device and if the last bit is 1 slave will send data to the master which is in a read operation. When 7-bit addressing scheme is employed, a total of 128 devices can be connected to the same I2C device. Acknowledgement needs to be sent after each data transfer by the receiving device in the I2C network whether it is a master or a slave.
If data is continuously fed into the master by the slave, then the master should send a non-acknowledgment before the last byte. The whole communication between the master and slave is terminated when the master sends a stop condition.

OpenLab Hardware Setup for Configuring AT24C16A

OpenLab supports 8 pins I2C compatible EEPROM. AT24C16A can be used with the openLab. The pull up resistors which have to be connected to the open drain SCL and SDA lines are available with the OpenLab. All we have to do is to connect J23 and J24 jumpers with EEPROM and I2C of the controller.

Set up any user interface for read/ write operation of EEPROM. Select PC serial terminal or the LCD or GLCD available on OpenLab for this user interface. We describe here an example of a read/ write operation of EEPROM using IO through PC serial terminal (visualized using RealTerm software).

Now, configure USART module of the microcontroller PIC18F4550. See the section, hardware setup & wiring guide for serial communication. This will allow a serial terminal at your personal computer or laptop, to communicate with a microcontroller for sending data to be written in EEPROM data memory and receiving data for memory.

Share