I2C PIC Interfacing Tutorial

Current Part:

PIC 18F452 Microcontroller
24LC02B I2C Memory
7805 +5v Regulator
1x 10kΩ Resistors
1x 1kΩ Resistors
1x 260Ω Resistors
47uF Capacitor
5kΩ Trimpot
40 MHz Crystal
16x2 LCD Screen
Breadboard Wire
PICKIT2 Programmer

Parts List Details
           This tutorial doesn't require too many parts which is a nice change from others. The main parts of the PIC, the LCD and the I2C Memory chip. A few other parts are important and I'll describe all the key parts in short below.

PIC 18F452
           The PIC will be used as the 'Master' device for this tutorial on I2C interface communication. This means that it has control over which device sends what data and it has the power to ask device to identify themselves. The PIC will also output to the LCD so that we can know if a I2C communication has been successful.
24LC02B I2C Memory
           In order for I2C communication to work properly, you need a 'master' and a 'slave'. The 24LC02B will be used as the 'slave' for this tutorial. This device is 2k (256 x 8bits) of memory which means there are 256 places where we can store 8 binary bits of memory. 256 x 8 = 2048.

16x2 LCD Screen
           The 16x2 LCD will be used in this tutorial as a means of telling us what has happened either erroneously or successfully (ideally success will always be had). In particular, we will want to see which random numbers are generated by the PIC and if they were actually written to the I2C memory chip.

40 MHz Crystal
           This is the crystal that will be used to dictate instruction cycle speed. The PIC18F452 has a top speed of 40 MHz so don't go any higher! The I2C clock speed is derived from this clock speed, so if you are using a slower crystal, say 20 MHz, take extra note in the theory section where this number is used in a formula to dictate I2C clock speed. Don't forget!

Breadboard Wires, Resistors and the Breadboard
           Since this tutorial uses a breadboard, you will obviously need to have one! The breadboard wire used is AWG 22 and you can get them in these jumper wire kits for a good price. The Resistors used in this tutorial are used for current limiting before the LED backlight in the LCD and pull-up (to +5v) for MCLR on the PIC.