5 * (C) 2013-06-10 K.Ohta <whatisthis.sowhat ai gmail.com>
9 #include <pic18fregs.h> /* ONLY FOR PIC18x */
16 INTCON = _TMR0IE & ~(_TMR0IF | _INT0IF | _RBIF); // Enable tmr0 as interrupt and clear interrupt flags.
17 INTCON2 = ~_TMR0IP & _TMR0IP; // Interrupt is lower.
18 WDTCON = 0; // OK? WDT=Disabled.
28 void idle(unsigned int initial)
31 unsigned char contword;
35 osccon = osccon | _IDLEN | _SCS1 | _SCS0;
38 /* Set TMR0 for interrupt*/
39 /* Pre-scaler: 1/16, PSA=0(ON), TOSE=0, T0CS=0(INTERNAL), T08BIT=1(8bit), TMR0ON=1(START) */
40 contword = _T0PS0 | _T0PS1 | _T08BIT | _TMR0ON; // _T0PS2
42 TMR0L = initial & 0xff;