dayanpad
Advanced Member level 4
Dear All please assist
following codes for DS1307RTC
it does not work with Real Simulator
MCU is 16f877
void main(){
ANSEL = 0; // Configure AN pins as digital I/O
ANSELH = 0;
PORTB = 0;
TRISB = 0; // Configure PORTB as output
I2C1_Init(100000); // initialize I2C communication
I2C1_Start(); // issue I2C start signal
I2C1_Wr(00); // send byte via I2C (device address + W) device address as per real pic simulator
I2C1_Wr(3); // send byte (data address)
I2C1_Repeated_Start(); // issue I2C signal repeated start
I2C1_Wr(00); // send byte (device address + R)
PORTB = I2C1_Rd(0u); // Read the data (NO acknowledge)
I2C1_Stop();
above codes using mikroC pro for PIC compiler
you can download real pic simulator following link
https://digitalelectrosoft.com/download/RealPicSimulator.exe
following codes for DS1307RTC
it does not work with Real Simulator
MCU is 16f877
void main(){
ANSEL = 0; // Configure AN pins as digital I/O
ANSELH = 0;
PORTB = 0;
TRISB = 0; // Configure PORTB as output
I2C1_Init(100000); // initialize I2C communication
I2C1_Start(); // issue I2C start signal
I2C1_Wr(00); // send byte via I2C (device address + W) device address as per real pic simulator
I2C1_Wr(3); // send byte (data address)
I2C1_Repeated_Start(); // issue I2C signal repeated start
I2C1_Wr(00); // send byte (device address + R)
PORTB = I2C1_Rd(0u); // Read the data (NO acknowledge)
I2C1_Stop();
above codes using mikroC pro for PIC compiler
you can download real pic simulator following link
https://digitalelectrosoft.com/download/RealPicSimulator.exe
Last edited: