// Alternative bit function
const register unsigned short int SCL = 3;
sbit SCL_bit at PORTC.B3;
// Alternative bit function
const register unsigned short int SDA = 4;
sbit SDA_bit at PORTC.B4;
oh my....I can see my stupid mistake here.(delay_ms)thanks.
I could solve my previous problem with this code:
Code:
sbit SSDA at RC4_bit;
sbit SSCL at RC3_bit;
sbit SSDA_Direction at TRISC4_bit;
sbit SSCL_Direction at TRISC3_bit;
void main() {
SSDA_Direction=0;
SSCL_Direction=0;
do{
SSDA = 1;
SSCL = 0;
delay_ms(2000);
SSDA = 0;
SSCL = 1;
delay_ms(2000);
} while(1);
}
but it's a Trick.when I disabled I2C Library the error did not disappear (Identifier redefined), so I used the Trick. Do you have any simply example with PIC18F for I2C communication(Compatible with Mikroc PIC)?