unsigned char george, count;
void interrupt() {
if(intcon.TMROIF){
george++;
intcon.TMROIF = 0;
}
if(pir1.TMR1IF){
pir1.TMR1IF = 0;
}
if(pir1.TMR2IF){
pir1.TMR2IF = 0;
}
}
void configuration(void) {
trisb = 0;
portb = 0x0f;
// set internal oscillator to 8Mhz
osctune.tun4 = 0;
osctune.tun3 = 1;
osctune.tun2 = 1;
osctune.tun1 = 1;
osctune.tun0 = 1;
//======== enable timer 0 interrupt and set as hi priority=================//
t0con = 0b11010101 ;
intcon.TMR0IF = 0;
intcon.TMR0IE = 1;
intcon2.TMR0IP = 1;
/*//========enable timer 1 interrupt and set as hi priority===================//
t1con.rd16 = 1;
t1con.TMR1CS = 0;
t1con.T1CKPS1 = 1;
t1con.T1CKPS0 = 1;
t1con.tmr1on = 1;
pie1.TMR1IE = 1;
ipr1.TMR1IP = 1;
//========enable timer 2 interrupt and set as hi priority===================//
t2con.t2ckps1 = 1;
t2con.t2ckps0 = 0;
t2con.tmr2on = 1;
pie1.TMR2IE = 1;
ipr1.TMR2IP = 1;
//======= enable global and peripheral int.=================================//
*/
intcon.peie = 1;
intcon.gie = 1;
intcon.gieh = 1;
}
void main(){
configuration();
while(1){
if (george == 10){
count++
portb = count;
george = 0;
}
}
}