So far I have worked with many other micro controllers but not the PIC-family. I'm having trouble with waking from sleep via watchdog on a PIC10F200. I'm programming it in C using the MPLAB X IDE v2.35. All function's an macros are part of microchip's baseline libraries for the processor.
Here is a minimal example of what my problem is:
#include <xc.h>
#pragma config CP = OFF // Code protection off
#pragma config MCLRE = OFF // GP3/MCLR pin fuction is digital I/O
#pragma config WDTE = ON // Watchdog Timer enabled
#define _XTAL_FREQ 4000000
void main(void) {
OPTION = 0 | nGPWU | nGPPU & ~T0CS & ~T0SE | PSA | PS2 | PS1 | PS0; // bits: 7: no wake-up on pin change; 6: no weak pullups; 5: internal clock; 4: incremnt low to high; 3: prescale on wdt (Timer0 if cleared); 2-0: clock division by 128
TRISGPIO = 0b00000000; // set all to output
while(1) {
GP0 = 1; GP1 = 1; GP2 = 1; SLEEP(); // set all high and sleep a bit
GP0 = 0; GP1 = 0; GP2 = 0; SLEEP(); // set all low and sleep a bit
}
}
Basically this is a classic toggle-pin (blink LED) example using the watchdog. Only the pins are high all the time. What did I do wrong?