If you want to set PORTA of PIC16F877/877A/874, You have to use some extra register configurations with ADCON1 and COMCON registers .
COMCON=0x07 disables the comparators
ADCON1 = 0x06 makes all the pins of PORTA as Digital I/O by default it is Analog .
Example
void main (){
ADCON1 =0x06 ; // Changes PORTA to digital
CMCON = 0x07 ; // Disable analog comparators
TRISA = 0x00 ;
while(1)
{
PORTA = 0XFF ;
Delay_ms(500) ;
PORTA = 0X00 ;
Delay_ms(500) ;
}
}
You need a special care in the case of PORTA4 (RA4), it is Vref to the comparator . A pull up resister is need to wok it. So read details of PORTA before using RA4.
2 comments:
its use C language
Thanks
Page with lot of information about pic micro controller:
http://www.artic-instruments.info
Post a Comment