SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By amsung2
#56944
in order to generate 5ms delay using 11.0592mhz crystal, what are the values to be loaded into TH0 and TL0? (mode1, 16 bit counter)
in mazidi, the values say:
5ms/1.085us=60926 thus TH=EE and TL=00
but another book tells me to do the no. to be loaded is19457
and also instructs to perform the following calculation before lading the values in TH and TL:
TH0 * 256 + TL0 = 19457
assuming TL0=1
TH0=76.
thus the values to be loaded are:th=4c and tl=01
which one is correct?
Also;
when the timer in 8051/89c51 is innitialised, it counts up to ffffh, in the mean time, can the other registers be used for other purposes, or do i need another microcontroller to do the job? my project is regarding RTC, so i need accuracy. i don't want to burden the microcontroller and get errors as a result, but at the same time i don't want to have 2 microcontrollers eating up the power....
i intend to use the CF in the TCON to generate a pulse at any of the port pins, and then use this pulse to drive the other microcontroller.
can i use a single ocsillator to provide the clock to both the microcontrollers or do i need 2 oscillators?
please help!!!
By newbie123
#57154
amsung2 wrote:in order to generate 5ms delay using 11.0592mhz crystal, what are the values to be loaded into TH0 and TL0? (mode1, 16 bit counter)
in mazidi, the values say:
5ms/1.085us=60926 thus TH=EE and TL=00
but another book tells me to do the no. to be loaded is19457
and also instructs to perform the following calculation before lading the values in TH and TL:
TH0 * 256 + TL0 = 19457
assuming TL0=1
TH0=76.
thus the values to be loaded are:th=4c and tl=01
which one is correct?
if you are unsure, you can use the 8051 simulator to check the timing.
You should learn to use the simulator, it will save you valuable time and headaches, especially if you are a beginner.
amsung2 wrote: Also;
when the timer in 8051/89c51 is innitialised, it counts up to ffffh, in the mean time, can the other registers be used for other purposes, or do i need another microcontroller to do the job?
the timer is hardware based and will not affect your software that is running in the 8051.
amsung2 wrote: my project is regarding RTC, so i need accuracy. i don't want to burden the microcontroller and get errors as a result, but at the same time i don't want to have 2 microcontrollers eating up the power....
i intend to use the CF in the TCON to generate a pulse at any of the port pins, and then use this pulse to drive the other microcontroller.
can i use a single ocsillator to provide the clock to both the microcontrollers or do i need 2 oscillators?
please help!!!
You do not need two microcontrollers.
if you have the mazidi book, read it. Take a look at what the book says about clocking. You can use the same clock for both microcontrollers.

If you post a schematic of what you are trying to accomplish, lots of guys will be able help you better.

Good Luck