Good morning everyone,
I'm using my old PICkit 2 and 44 pin demo board from my school days to get "re-aquainted". I'm using the hi-tech c compiler.
I made a simple program to turn on the the 8 lights connected to PORTD when the button connected to RB0 is pressed, and then go out when not pressed. I notice that sometimes when the lights come on, one or two of them are not lit. No specific ones In particular.
I've also noticed a few anomalies when I make changes in my program statements.
For example, I used an "if/else" statement;
ANSEL = 0x00
ANSELH = 0x00
Void main (void)
{
If (RB0 = 0x00)
TRISD = 0XFF;
ELSE
TRISD = 0xFF;
}
Now this program does turn the lights on and off. But when I change the argument of RB0 = 0x00 to RB0 = 0x01 I would expect this to work opposite of how it did before, yet it doesn't.
I'm not sure if my thinking / program is incorrect or if the PIC is internally compromised somehow. A "shove" in the right direction would be appreciated
I'm using my old PICkit 2 and 44 pin demo board from my school days to get "re-aquainted". I'm using the hi-tech c compiler.
I made a simple program to turn on the the 8 lights connected to PORTD when the button connected to RB0 is pressed, and then go out when not pressed. I notice that sometimes when the lights come on, one or two of them are not lit. No specific ones In particular.
I've also noticed a few anomalies when I make changes in my program statements.
For example, I used an "if/else" statement;
ANSEL = 0x00
ANSELH = 0x00
Void main (void)
{
If (RB0 = 0x00)
TRISD = 0XFF;
ELSE
TRISD = 0xFF;
}
Now this program does turn the lights on and off. But when I change the argument of RB0 = 0x00 to RB0 = 0x01 I would expect this to work opposite of how it did before, yet it doesn't.
I'm not sure if my thinking / program is incorrect or if the PIC is internally compromised somehow. A "shove" in the right direction would be appreciated