Bob Parihar
Member
i am working on PIC16F877A using mikroc compiler and iam facing a problem in knowing the input output configuration of this micro controller.
My task is simple i am monitring the status of a pin at RC1 by making that pin input using TRISC=1(actually i make the whole port input) and by monitring that pin i want that whenever the pin goes high it should on the lED at Pin RB1
here is my code
sbit b at RB1_bit; // to control led at this pin
sbit a at RC1_bit; // to monitor the push button( i connected on end to the vcc and second end to the pin)
void main() {
TRISB=0;
TRISC=1;
while(1)
{
if(a==1)
{
b=1;
}
else
b=0;
}
}
actually iam getting what i want.. but iam confused because when i press the button a yellow light is shown at that pin when iam using simulator that is PROTEUS 7.
why it is yellow? it should be RED(for logic 1).. by default it is BLUE(for logic 0)
My task is simple i am monitring the status of a pin at RC1 by making that pin input using TRISC=1(actually i make the whole port input) and by monitring that pin i want that whenever the pin goes high it should on the lED at Pin RB1
here is my code
sbit b at RB1_bit; // to control led at this pin
sbit a at RC1_bit; // to monitor the push button( i connected on end to the vcc and second end to the pin)
void main() {
TRISB=0;
TRISC=1;
while(1)
{
if(a==1)
{
b=1;
}
else
b=0;
}
}
actually iam getting what i want.. but iam confused because when i press the button a yellow light is shown at that pin when iam using simulator that is PROTEUS 7.
why it is yellow? it should be RED(for logic 1).. by default it is BLUE(for logic 0)