Please correct this noob if I'm completely missing something, but I thought in an if statement that "if" wasn't met, then the code continued to be processed.
In the following code, when the pic is powered I thought that if GP3 == 0, which it does until I press the button I have in circuit, that the else statement would have GP5 set until the while loop came back around and found GP3 set.
However, in actual practice, the pic does nothing til I hit the GP3 button which starts the ledloop function and then GP5 will go high.
I'm a noob at uControllers and C so if you could point me in the right direction I would appreciate it.
Thanks.
void main(void) {
TRISIO = 0b00001000;
GPIO = 0b00000000;
ANSEL = 0;
CMCON0 = 0b00000111;
OSCCON = 0b01110111;
int ledloop();
while(1){
if(GP3 == 1){
ledloop();
}
else{
GP5 = 1;
}
}
return;
}
In the following code, when the pic is powered I thought that if GP3 == 0, which it does until I press the button I have in circuit, that the else statement would have GP5 set until the while loop came back around and found GP3 set.
However, in actual practice, the pic does nothing til I hit the GP3 button which starts the ledloop function and then GP5 will go high.
I'm a noob at uControllers and C so if you could point me in the right direction I would appreciate it.
Thanks.
void main(void) {
TRISIO = 0b00001000;
GPIO = 0b00000000;
ANSEL = 0;
CMCON0 = 0b00000111;
OSCCON = 0b01110111;
int ledloop();
while(1){
if(GP3 == 1){
ledloop();
}
else{
GP5 = 1;
}
}
return;
}