[time-nuts] Enhancing the TIC232 code for better data
Richard H McCorkle
mccorkle at ptialaska.net
Sat Aug 12 18:30:24 UTC 2006
Here is an insider tip for the Time-Nuts community:
Although the Simple Time Interval Counter works quite well with
it's present code, it was designed as a demonstration of adding
Simple Commands to a program. The code can be enhanced for
less noise in the data when being used in serious work by making
a few modifications to the code.
As designed a 32-bit phase counter accumulates multiple samples
until the sample time is reached. Multiple gates of the clock to the
phase counter has been shown to produce higher noise in the data
than reading and resetting the phase counter on each sample and
accumulating the samples in a separate register. By taking a 24-bit
sample each second, adding it to a 32-bit accumulator, and clearing
the phase counter before the next sample, less noise is introduced
into the data giving improved results.
To enhance the performance of the Simple Time Interval Counter
for serious use make the following changes to the code:
1. Change the TMR1 overflow counter in the background routine
to 8-bit making a 24-bit phase counter.
2. Define a separate 32-bit register as a phase accumulator.
3. Define a 32-bit add routine to add the 24-bit phase data to the
32-bit phase accumulator and clear the phase counter.
4. Modify the interrupt routine to read the phase counter, add the
result to the 32-bit phase accumulator, and clear the phase
counter on each interrupt.
5. Display and clear the 32-bit phase accumulator at the selected
averaging time.
By making these modifications to the Simple Time Interval Counter
the modified TIC can provide cleaner data capable of analysis in the
sub nanosecond range for use in serious timing work.
.
Enjoy!
Richard H McCorkle
More information about the Time-nuts_lists.febo.com
mailing list