What causes turning ON a single output pin on Microchip PIC16F690 to spontaneously turn OFF another pin on the same port? I can work around this problem by writing a byte to the entire port, controlling all pins simultaneously, instead of just a bit to control the pin state. I'm using the Hi-Tech C compiler here. I am determining the state of the pin with 9 LEDs each consuming 3 mA. This is way below the max power specs.
The mplab header file has the 0 pin on port A declared as such:
volatile bit RA0 @ ((unsigned)&PORTA*8)+0;
I am turning the pin on by writing a high value to it.
RA0 = 1;
Is the problem that the complier is treating the "1" as a byte and writing to the whole port? Do I need to cast it? If so, shouldn't have the complier given me an error?
RA0 = (bit) 1;
If I write to the whole port everything works as expected:
PORTA = 0b00000001;