|Last Update: 11/08/08|
PIC Project #1 - RS232 to I2C Interface
The MicroChip PIC16C63 provides the intelligence and both the SCI and I2C peripherials to power the I2C232 adapter.
For more information on the I2C interface, look at the pdf file from Philips Semiconductor - The I2C Bus and how to use it.
The software sample is written in C for a specific application. A general purpose interface is not available at this time but is planned for the future. The information detailed here should provide the basic framework for designing and implementing your I2C application quickly and efficiently.
Provide a simple interface device ideally suited for interfacing a PC (or similiar device) to an I2C bus. Commands must use simple ASCII characters as commands.
The I2C232 uses a PIC16C63 (click here for data sheet) from Microchip. The PIC16C63 (U1) contains a serial interface and an I2C interface and makes this project simple and yet very powerful. The ceramic resonator, Y1, provides an 8 Mhz clock frequency.
Power to the module is provided through connector J1 pin 1 with pin 2 providing the ground. Diode D1 protects against reverse voltage and Z1 clamps the input voltage to save levels. Voltage regulator U3 converts the input voltage to +5 volts.
The MAX232 (U2) converts the +5 volt signals from the micro to RS232 levels. Connector J1 is a 25 pin female connector (DB25).
The software is written in C and compiled using the CCS C Compiler. I recommend this compiler as the $99 was a small investment that saved alot of time.
The C source file pici2c.c contains the RS232 interrupt service routine that collects the commands. After the command is captured the main() function processes the RS232 command into an I2C message. The sample shown is application specific but can be tailored to any other application.