Ogu Reginald
Full Member level 6
I want to use either Timer0 or Timer1 of the AT89S52 microcontroller to measure external pulse. While reading, I came across an example that tries to set up timer0.
The example is using a frequency of 24MHz.
Below is a part of the code.
TMOD=0x52; // timer 0 mode 2, counter 1 mode 1
THO=5;//makes the timer to overflow every 125 uS (divide by 250).
Please can someone help me and explain the two lines above.
If there are equations to help me, please attach. I want the timer to reload every second and I want to use 12MHz.
If I want to use Timer 1 Mode 2, what will I use.
The example is using a frequency of 24MHz.
Below is a part of the code.
TMOD=0x52; // timer 0 mode 2, counter 1 mode 1
THO=5;//makes the timer to overflow every 125 uS (divide by 250).
Please can someone help me and explain the two lines above.
If there are equations to help me, please attach. I want the timer to reload every second and I want to use 12MHz.
If I want to use Timer 1 Mode 2, what will I use.