From: K.Ohta Date: Mon, 10 Jun 2013 20:38:50 +0000 (+0900) Subject: [IDLE] Enable idle-mode before kicking tmr0. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=14dd6f892a5cb009b3582f997a2c07a0e25d3c1f;p=openi2cradio%2FOpenI2CRadio.git [IDLE] Enable idle-mode before kicking tmr0. --- diff --git a/idle.c b/idle.c index 7e42613..b944d77 100644 --- a/idle.c +++ b/idle.c @@ -30,6 +30,11 @@ void idle(unsigned int initial) 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 @@ -37,8 +42,5 @@ void idle(unsigned int initial) TMR0L = initial & 0xff; T0CON = contword; - osccon = OSCCON; - osccon = osccon | _IDLEN | _SCS1 | _SCS0; - OSCCON = osccon; Sleep(); }