unsigned char osccon;
unsigned char contword;
+ /* Enable IDLE */
+ osccon = OSCCON;
+ osccon = osccon | _IDLEN | _SCS1 | _SCS0;
+ OSCCON = osccon;
+
/* Set TMR0 for interrupt*/
/* Pre-scaler: 1/16, PSA=0(ON), TOSE=0, T0CS=0(INTERNAL), T08BIT=1(8bit), TMR0ON=1(START) */
contword = _T0PS0 | _T0PS1 | _T08BIT | _TMR0ON; // _T0PS2
TMR0L = initial & 0xff;
T0CON = contword;
- osccon = OSCCON;
- osccon = osccon | _IDLEN | _SCS1 | _SCS0;
- OSCCON = osccon;
Sleep();
}