#pragma stack 0x200 256
#pragma config FOSC=HS,FCMEN=ON,PWRT=ON,BOREN=NOSLP,BORV=27, \
- WDTEN=ON,WDTPS=32768,PBADEN=OFF,HFOFST=ON,LPT1OSC=OFF, \
+ WDTEN=ON,WDTPS=32768,PBADEN=OFF,HFOFST=OFF,LPT1OSC=OFF, \
MCLRE=ON,STVREN=ON,DEBUG=ON, \
XINST=OFF
//#pragma config CP0=OFF,CP1=OFF,CP2=OFF,CP3=OFF
#ifdef __SDCC
OSCCON = (0x80 & 0b11111100) | 0b00111000;
+// OSCCON = (0x80 & 0b11111100) | 0b00110010; // 8MHz
#else
OSCCON = (_OSCCON_IDLEN_MASK & 0b11111100 ) | 0b00111000;
#endif
power_off(0); // Save and halt on BOR.
break;
case RESET_SOFTWARE: //
- do {
- pbutton = chk_powerbutton();
- ClrWdt();
- if(pbutton == 0) power_off(0); // Button not pressed.
- } while(pbutton == 0);
+// do {
+// pbutton = chk_powerbutton();
+// ClrWdt();
+ // if(pbutton == 0) power_off(0); // Button not pressed.
+// } while(pbutton == 0);
break;
default:
break;
// printstr("OK");
lcd_setbacklight(0xff, 255);
do {
-// if(battlevel <= 408) { // 4.80*0.85
- // lowbatt();
- // }
+// set_powerlamp(0);
+ if(battlevel <= 340) { // 3.4V
+ lowbatt();
+ }
/* Main routine*/
-#if 1
- c = pollkeys(pollkeybuf, 60, 1);
+ c = pollkeys(pollkeybuf, 10, 1); // 23*10=230ms
p = 0;
while(c > 0) {
ClrWdt();
c--;
p++;
}
-#else
- c = pollkey_single();
- setfreq_updown(c);
-#endif
+// set_powerlamp(1);
// idle_time_ms(ui_idlecount);
// Putstring to LCD.
_LOCATE(0,0);
lcd_setbacklight(0x00, 0); // Turn OFF
}
update_status();
- ClrWdt();
+// ClrWdt();
update_display();
ClrWdt();
} while(1);