??? 09/17/11 05:34 Modified: 09/17/11 06:08 Read: times |
#183782 - "formulae" Responding to: ???'s previous message |
Your Timer is running with XTAL/12 .
For every count in timer You have tick=((1/xtal))*12 time spended. Timer's flag TF is settled when timer over-counts from 0ffffh to 10000h. Most significant bit does not exist in 16 bit timer, so TF is settled when timer changes from 0ffffh to 0000h. You are loading Timer1=TH1TL1==7634h ==35276(dec). So (65536-TH1TL1)*tick is time between loading timer and settling TF1, in Your program this is semiperiod of output freq. For F output frequency You have 1/2F seconds semiperiod. 1/(2*F)=(65536-TH1TL1)*tick. Maximum semiperiod is 65536*tick, in Your case - 0.07 sec. So You need: - to change crystal (which is not usual practice) OR - to 'extend' counter's bit in software: --- usually timer's setup is with thick 1, 10, 20 milliseconds - to be easy remembered and used for calculations in mind. Assume 10 milliseconds - TH1TL1 should be (65536-9216). Then in some variable THIGHBITS count from 0 to 25 on every TF1 settling. When THIGHBITS becomes 25 - clear this variable and toggle output. With 555 You can do it easy, but how about 10 microseconds pulse on each 10 minutes? Microcontrollers are fun for hobby. good luck |