tahir4awan
Full Member level 4
I wrote a simple code to write and read data from EEPROM. The code is working
for all ports except PORTB. What is the problem?
----------------------------------------------------------------------------
void main(){
ANSEL = 0; // Configure AN pins as digital I/O
ANSELH = 0;
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;
TRISB = 0x00;
PORTB = 0x00;
EEPROM_Write(0x50,0xAA);
Delay_ms(1000);
PORTB = EEPROM_Read(0x50);
}
----------------------------------------------------------------------------
Secondly MikroC uses its own built in functions
EEPROM_Write(0x50,0xAA);
EEPROM_Read(0x50);
and PIC microcontroller has EECON1 and EECON2 registers. What is the difference?
for all ports except PORTB. What is the problem?
----------------------------------------------------------------------------
void main(){
ANSEL = 0; // Configure AN pins as digital I/O
ANSELH = 0;
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;
TRISB = 0x00;
PORTB = 0x00;
EEPROM_Write(0x50,0xAA);
Delay_ms(1000);
PORTB = EEPROM_Read(0x50);
}
----------------------------------------------------------------------------
Secondly MikroC uses its own built in functions
EEPROM_Write(0x50,0xAA);
EEPROM_Read(0x50);
and PIC microcontroller has EECON1 and EECON2 registers. What is the difference?