how to make a clock pulse (any formula)

I am using ATMEL 8052 microcontroller,I wana use timer zero
interrupt in mode 1 for generating clock pulse on a pin (for random
number generator).
Bbbbut i don't know what should be the timer values.
would some body please tell me about the formula ?
I am using 11.059 crystal and i want to create 1khz clock.
waiting for urgent reply
Reply to
Loading thread data ...
Urgent plzzz ... Amara
Reply to
Do you have a data sheet for the processor you are using?
Could you type in the register settings for us so we can tell you which bits to set.
Generally, there are two registers. One for dividing the internal clock by some factor to drive the counter, and another one that sets how many counts before the counter resets.
There are usually a few bits to set the counter mode. count up, count down etc.
If you can post the relevant parts of the data sheet, I'm sure we can help.
Reply to
Alan Kilian
I don't know much about these processors, but I'd suggest reading the datasheet and choosing an approximate value.
Then put your 1kHz estimate into a timer. Set the interrupt routine to decrease a value which starts at 10000. When this value reaches 0, then flp the value of an output pin connected to an LED (and reset the counter value).
When the LED changes value every 10 seconds you've got what you wanted.
If the timing is too long or too short, then reread the datasheet and reestimate the timer value. -- D. Jay Newman
Reply to
D. Jay Newman
formatting link
look at the tutorials
lots of others on the net for 8051's also read the atmel application notes for the 8051
formatting link

Reply to
Alex Gibson
Hi Amara,
I'm not too familiar with the 8052 but at least with the AVR family there is an 8 bit timer counter control register that has a number of bits that select different modes such as clear on compare when counting up or down and also selecting a prescaler which basically tells the timer to count up or down every so many clock cycles giving you some control over the frequency. You can load whatever value into the compare register to generate different duty cycles if needed. In any case the formulas and timing diagrams you need should be in the datasheet for your device as others have mentioned. There aren't an infinite number of prescalers available so you may not be able to get exactly 1khz. Depending on how precise the clock pulse needs to be you could also use a 555 timer in an astable configuration to generate a 1khz pulse. Read through the datasheet and if you have any more questions just ask. Hope that helps.
Reply to

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.