Hi, I'm just trying to understand a few things from your code in the first = link. What's the significance of 100Hz with 1 second counting? :) What is the rb part? I can't find any reference to it in the MPASM help fil= e. :) ticks rb ;count IRQs (200 per sec) dg1 rb ;digit1 data dg2 rb dg3 rb dg4 rb temp rb loop rb count rb ;digit to show (1 2 4 8) On Mon, Nov 7, 2011 at 11:34 PM, IVP wrote: >> Hello, I'm looking for some ideas on how I can start building (the >> software) a race timer. This timer has to count at least 20 seconds >> and be accurate enough to 100th of a second. > > First thing to do is choose a crystal or method that will give you a > 100Hz timebase > > For the timers I build I generally use a 'hex' crystal, something which > divides evenly by 256. For example, 3.276800MHz (=3D 0x320000) > > (Sorry about the colours, I really should update these pages) > > http://home.clear.net.nz/pages/joecolquitt/2wireled.html > > 3276800 / 256 =3D 12800 =3D 128 Timer0 interrupts per 10ms. The timer > can be free-running, and the test for 128 is simply looking at bit7 of th= e > interrupt counter > >> An LCD would display the time to 3 decimal places > > 3 decimal places is better than 0.01, unless you want to measure to > 1/1000ths internally and round to the 1/100th > > Common alpha-numeric displays are fast enough for 1/100ths but > I prefer to use panel LCDs or LEDs, as they're bigger and faster > > This circuit, with a faster crystal, has been used as a 1/1000ths > gated timer > > http://home.clear.net.nz/pages/joecolquitt/0sp505.html > > This is a counter and 1/10,000ths timer. 10MHz is adequate > > http://home.clear.net.nz/pages/joecolquitt/0counter.html > > Software for a timer is very simple, simpler than a clock, as it's all > based on decades, ie each digit is 10x the one preceeding it > > You might want to think about using a 0 - 20,000 counter and > converting it to 5-digit ASCII for display, rather than work out > each digit individually > > http://www.piclist.com/techref/microchip/math/radix/index.htm > > Can help you more if you have specific questions > > Joe > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .