Searching \ for '[PIC] race timer ideas' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/time.htm?key=time
Search entire site for: 'race timer ideas'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] race timer ideas'
2011\11\07@044304 by bakup 725

picon face
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.

An LCD would display the time to 3 decimal places and the circuit will
have a "start", "stop" and "reset" buttons only. Hardware is not an
issue.

If you have any ideas or any other info then please put it here. Thanks.

Oh BTW, I use 18F4520.

T_AD

2011\11\07@053503 by IVP

face picon face
> 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 (= 0x320000)

(Sorry about the colours, I really should update these pages)

http://home.clear.net.nz/pages/joecolquitt/2wireled.html

3276800 / 256 = 12800 = 128 Timer0 interrupts per 10ms. The timer
can be free-running, and the test for 128 is simply looking at bit7 of the
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

Jo

2011\11\07@100400 by Dennis J. Murray

picon face
I've done something similar for my church youth group, who needed to determine the winner of a 4-lane, 25' long race.  It was amazing how close some of the cars were crossing the finish line!!  I used a 16F876, since that is what I had on hand.  Program is in MPASM.

I started the timer when the cars were released at the start gate and stopped the timer when the first car crossed the finish line (broke an infrared light beam - one per lane).  I then displayed the winner via an LED mounted above his lane and displayed the scale "speed" in approx. MPH on a large, multiplexed, LED display.  The kids didn't like the "slow" accurately-scaled MPH displayed, so I fudged it to make it seem the cars were going somewhat faster than they really were!  It is easy enough to change - just modify one constant and recompile and you're good to go!  Should be noted that finish MPH was calculated based on average speed *2 (SERIOUS approximation, assuming linear acceleration).

Anyway,the kids were happy, so that made it worthwhile!

If you're interested in my code, contact me offline & I'll send it to you.

Should be noted, there's hardware to build - at least a microswitch at the start and sensors at the finish.

Good Luck!
Dennis

On 11/07/2011 04:43 AM, backup 725 wrote:
{Quote hidden}

> T_AD

2011\11\08@011139 by bakup 725

picon face
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 file. :)

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 <spam_OUTjoecolquittTakeThisOuTspamclear.net.nz> wrote:
{Quote hidden}

>

2011\11\08@021323 by IVP

face picon face

> What's the significance of 100Hz with 1 second counting? :)

100Hz (or a multiple of) is the frequency of timer IRQs, not an
actual waveform frequency in the hardware as such

> What is the rb part? I can't find any reference to it in the MPASM
> help file. :)
>
> ticks  rb                  ;count IRQs (200 per sec)

It simply reserves a byte for counting ticks. Note that it's old (very
old) code, before I started using MPLAB, which uses 'res'. I'd have
to go back to WFW to compile most of those programs again ;-)) !!

The point is that the logic (or the resulting code) hasn't changed

All that's needed is a source of interrupts and a number of counters/
digits to increment

Many ways to do it, but for example something like -

Set Timer1 to produce 100 IRQs/sec
Test Start button or event
Increment 100ths counter
Test buttons (Stop, Pause, Reset etc)
Increment seconds counter when 100ths = 100
And/or update display
Loop to Increment 100ths counter

It will be a relatively short program

Jo

2011\11\08@042932 by bakup 725

picon face
Thank you very much for your input. I really appreciate. :) I hope I
can contact you directly for any future questions that I may have.

On Tue, Nov 8, 2011 at 8:13 PM, IVP <.....joecolquittKILLspamspam@spam@clear.net.nz> wrote:
{Quote hidden}

>

2011\11\08@044400 by IVP

face picon face
> Thank you very much for your input. I really appreciate. :) I hope
> I can contact you directly for any future questions that I may have

No problem. Good luck and have fun

Jo

More... (looser matching)
- Last day of these posts
- In 2011 , 2012 only
- Today
- New search...