29-03-2011, 03:45 PM
Chapter9.ppt (Size: 2.19 MB / Downloads: 95)
Steps to program in mode 1
1.Load the TMOD value
2.Load registers TL and TH
3.Start the timer (SETB TR0 or SETB TR1)
4.Keep monitoring the timer flag (TF)
5.Stop the timer (CLR TR0 or CLR TR1)
6.Clear the TF flag
7.Go back to step 2
Mode 2 Programming
1.Loaded value into TH (8-bit timer)
2.”SETB TR0” for timer 0 ;”SETB TR1” for timer 1
3.If TF (timer flag) = high “CLR TR0” or “CLR TR1”
4.Reloaded TL value kept by TH
Steps to program in mode 2
1.Load the TMOD value
2.Load the TH registers
3.Start the timer
4.Keep monitoring the timer flag (TF)
5.Clear the TF flag
7.Go back to step
Finding values to be loaded into the timer
Assuming XTAL =11.0592MHz from Example 9-10
1.Divide the desired time delay by 1.085μs
2.Perform 65536-n, where n is the decimal value we got in
Step 1
3.Convert the result of Step 2 to hex, where yyxx is the
initial hex value to be loaded into the timer’s registers
4.Set TL = xx and TH = yy