??? 01/07/09 14:18 Read: times |
#161362 - Better But Still An Issue Responding to: ???'s previous message |
Your reorganized code is better but there is still an issue that I see. At label AA: I would move the SETB TR0 instruction to below the clearing of TL0 and TH0 registers. This will help eliminate one more count of uncertainty in the measured value that occurs in your current example in that if an edge was counted right at label AA: you are clearing out that count.
It is hard to guess why you have a count accumulation that varies by as much as seven counts but there a number of factors to consider. First off even if the frequency source were known to be completely stable there can be count accumulation variance by a count or two just due to synchronization between the waveform and the measuring subsystem. Also consider that a variation of 7 counts out of about 800 is less than 1%. Other factors to consider: - Is the frequency source for your MCU stable enough. Maybe there is frequency variance in the MCU oscillator that you have not accounted for. - Is the 555 circuit short term stable in its frequency generation. Things like ground noise and poor wiring may be causing a half percent or so variation in the 555 signal frequency. - Is there a signal level problem at the Timer 0 input to the MCU. If the signal here had a marginal high or low level it is possible that during a measurement there could be mis-triggering of the T0 input. - Is it possible that there are noise spikes appearing at the T0 pin that get counted as edges when in fact they are not actually the normal 555 signal edges that you intend to count. Check the rise time of the signal too. Sometimes rise times are slower and may not be a fully monotonic signal. Check the fall time of the signal which is often very fast and can have ringing at the low corner. If the ringing rises back above the low level threshold of the T0 input it could end up getting counted. Michael Karas |
Topic | Author | Date |
Frequency (Event) Counter Problem | 01/01/70 00:00 | |
less than 1% error | 01/01/70 00:00 | |
Error % is incremental. | 01/01/70 00:00 | |
;STARTING BOTH THE TIMERS AT THE SAME TIME | 01/01/70 00:00 | |
Less variations in TL0 but still error | 01/01/70 00:00 | |
I do not know, but | 01/01/70 00:00 | |
CRO Frequency Measurement | 01/01/70 00:00 | |
Better But Still An Issue | 01/01/70 00:00 | |
How stabile is your signal source? | 01/01/70 00:00 | |
Very Good Point... | 01/01/70 00:00 | |
Easier if 89c52 is used | 01/01/70 00:00 | |
How stabile is your signal source? | 01/01/70 00:00 | |
NE555 is popular but not a precision device![]() | 01/01/70 00:00 |