Hello
If Interrupt service routine run 200 per seconds how to calculate timer higher value TH0 and timer lower value TL0 v ?
If Interrupt service routine run 200 per seconds how to calculate timer higher value TH0 and timer lower value TL0 v ?
Code:
#include<reg51.h> /*AT89c51*/
sbit led1 = P1^0; //LED connected to P0 of port 1
sbit led2 = P1^1; //LED connected to P1 of port 1
void timer(void) interrupt 1 //interrupt no. 1 for Timer 0
{
led1=~led1; //toggle LED on interrupt
TH0= ?; // what will TH0
TL0=?; // what will TL0
}
main()
{
TMOD = 0x01; // mode1 of Timer0
TH0 = ?; // initial values loaded to timer
TL0 = ?;
IE = 0x82; // enable interrupt
TR0 = 1; //start timer
while(1); // do nothing
}
Last edited: