OSDN Git Service

[SCHEMATIC] Modify SW/MW/LW Preamp, insert galbanic-isolator replace of common-mode...
[openi2cradio/OpenI2CRadio.git] / idle.c
diff --git a/idle.c b/idle.c
index 1e2fbc9..ae8db1d 100644 (file)
--- a/idle.c
+++ b/idle.c
@@ -39,7 +39,7 @@
 void idle_init(void)
 {
     RCONbits.IPEN = 1;
-//    INTCONbits.GIE = 1;
+    INTCONbits.GIE = 1;
 
     INTCONbits.TMR0IF = 0;
     INTCONbits.TMR0IE =  1;
@@ -60,15 +60,18 @@ void stop_idle(void)
 void idle(unsigned int initial)
 {
 
-    unsigned int i;
+   unsigned int i;
    WDTCONbits.SWDTEN = 0; // Lame WDT OFF.
    /* Enable IDLE */
    /* Set TMR0 for interrupt*/
    /* Pre-scaler: 1/2, PSA=1(ON), TOSE=0, T0CS=0(INTERNAL), T08BIT=0(16bit), TMR0ON=1(START) */
    /* 1Tick = 1/1000 ms*/
    T0CON = 0b00001000; // 1/2
+//   T0CON = 0b00001010; // 1/8
    OSCCONbits.IDLEN = 1;
    INTCONbits.TMR0IF = 0;
+   INTCONbits.TMR0IE = 1;
+//   TMR0L = initial & 0xff;
 //   TMR0H = initial >> 8; // Write order : L->H
    TMR0H = initial >> 8; // Write order : H->L
    TMR0L = initial & 0xff;
@@ -89,7 +92,6 @@ void idle_time_ms(unsigned int ms)
 
     if(ms == 0) return;
     upper = (ms & 0xffc0) >> 6;
-//    tim = ms * 8 - ms / 16 - ms / 8;
     tim = (ms   & 0x3f) * 1000; //
     tim = (65535 - tim) + 1; // tim = 65536 - tim;
     while(upper > 0) {