mikroC
making it simple...
Library Example
/* The example demonstrates use of Software I²C Library.
PIC MCU is connected (SCL, SDA pins) to PCF8583 RTC (real-time clock).
Program sends date data to RTC. */
void main() {
Soft_I2C_Config(&PORTD, 4,3);
Soft_I2C_Start();
Soft_I2C_Write(0xA0);
Soft_I2C_Write(0);
Soft_I2C_Write(0x80);
Soft_I2C_Write(0);
Soft_I2C_Write(0);
Soft_I2C_Write(0x30);
Soft_I2C_Write(0x11);
Soft_I2C_Write(0x30);
Soft_I2C_Write(0x08);
Soft_I2C_Stop();
Soft_I2C_Start();
Soft_I2C_Write(0xA0);
Soft_I2C_Write(0);
Soft_I2C_Write(0);
Soft_I2C_Stop();
} //~!
MikroElektronika: Development tools - Books - Compilers
mikroC - C Compiler for Microchip PIC microcontrollers
// Initialize full master mode
// Issue start signal
// Address PCF8583
// Start from word at address 0 (config word)
// Write 0x80 to config. (pause counter...)
// Write 0 to cents word
// Write 0 to seconds word
// Write 0x30 to minutes word
// Write 0x11 to hours word
// Write 0x24 to year/date word
// Write 0x08 to weekday/month
// Issue stop signal
// Issue start signal
// Address PCF8530
// Start from word at address 0
// Write 0 to config word (enable counting)
// Issue stop signal
page
257
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?