PIC18F4550 has a master synchronous serial ports (MSSP) module inside. This module consist of two sub-communication modules - I2C and SPI. An I2C is communication protocol for short range, low data rate requires only two pins - Serial Data(SDA) and Serial Clock(SCL). However, the SPI communication port doesn't lists here.
DS1307 is a real time clock keeper with I2C communication interface. This device keep the time running by an external crystal clock of 32.768 kHz. Even the supply voltage is off, a coin back up battery keep the data RAM synchronizes for future use. Since an I2C is use for communication, there are two communication pins - SDA and SCL. These two pins are open drain, require an individual external pull up resistor. The resistor ranges from 4.7 kOhm to 10 kOhm resistance.
For more technical details about DS1307, please see this post on another blog I wrote.
In this programming example, PIC18F4550 uses its I2C master to write and read timing data from DS1307 I2C slave device. Those data will display on a character display.
Circuit Simulation |
No comments:
Post a Comment