This a part of my entire code.
The timer 1 is intended to generate a 1sec delay,
during the 1 sec delay,
timer 0 will be counting the frequency of the pulse connected to it.
When TF1 is raised (after 1 sec),
The number of pulse (frequency) is displayed on an LCD.
Please don't bother on the timer0 and display sub programs, they have been well written.
My concern and problem is to generate 1 sec delay (I don't know the exact value to load to the TL1 and TH1).
Please carefully check the code for me, Thanks.
Below is the code:
Timer1 ()
{
TR1=0;
TMOD &=0x01; // timer 1 set to mode 1
TL0=0x00;
TH0=0x00;
TF1=0;
TR1=1;
while (TF1==0)
{
timer0 (); //count the frequency of the pulse connected timer 0
}
if (TF1==1)
{
Display (); //displays the d (d= Frequency/7)
}
}