mr_anderson
Advanced Member level 4
Hi
i am using mikroC to program PIC16F84A, it works just fine when i use the built-in libraries, but when i use the individual bits, it starts to function incorrectly, the code below should make RB3 OUT and RA2 IN, but it doesnot can any one tell me why?
void main()
{
TRISB.f3=0;// make RB3 out
TRISA.f2=1;// make RA2 in
while(1)
{
if (PORTA.f2) PORTB.f3=1
}
}
the code shown above works just fine when i replace
TRISB.f3=0 with TRISB=0;
and
TRISA.f2=1 with TRISA=0
it starts to function correctly can any one tell me why?
Best Regards
i am using mikroC to program PIC16F84A, it works just fine when i use the built-in libraries, but when i use the individual bits, it starts to function incorrectly, the code below should make RB3 OUT and RA2 IN, but it doesnot can any one tell me why?
void main()
{
TRISB.f3=0;// make RB3 out
TRISA.f2=1;// make RA2 in
while(1)
{
if (PORTA.f2) PORTB.f3=1
}
}
the code shown above works just fine when i replace
TRISB.f3=0 with TRISB=0;
and
TRISA.f2=1 with TRISA=0
it starts to function correctly can any one tell me why?
Best Regards