This is the code generated by mikroC timer calculator for 10 ms delay using timer0 ( I'm using pic18f4550)
//Timer0
//Prescaler 1:1; TMR0 Preload = 15536; Actual Interrupt Time : 10 ms
//Place/Copy this part in declaration section
void InitTimer0()
{
T0CON = 0x88;
TMR0H = 0x3C;
TMR0L = 0xB0;
GIE_bit = 1;
TMR0IE_bit = 1;
}
void Interrupt()
{
if (TMR0IF_bit){
TMR0IF_bit = 0;
TMR0H = 0x3C;
TMR0L = 0xB0;
//Enter your code here
}
}
My question is why Timer0 Register Low Byte and high byte is mentioned two times
1. inside InitTimer0() function??
2. Inside Interrupt() function??
//Timer0
//Prescaler 1:1; TMR0 Preload = 15536; Actual Interrupt Time : 10 ms
//Place/Copy this part in declaration section
void InitTimer0()
{
T0CON = 0x88;
TMR0H = 0x3C;
TMR0L = 0xB0;
GIE_bit = 1;
TMR0IE_bit = 1;
}
void Interrupt()
{
if (TMR0IF_bit){
TMR0IF_bit = 0;
TMR0H = 0x3C;
TMR0L = 0xB0;
//Enter your code here
}
}
My question is why Timer0 Register Low Byte and high byte is mentioned two times
1. inside InitTimer0() function??
2. Inside Interrupt() function??