PDA

View Full Version : timer question (probably for Mel)



muddy0409
- 12th September 2005, 12:19
Hello all, 'specially Melanie.
I got your olympic stopwatch working and did a cuppla mods to it as far as triggering start and stop, with not too many problems.
Also saw your post of 8 August '04 in relation to cutting out the bits that weren't wanted. Tried to incorporate them into my prog but no luck so far.
Perhaps they are a bit of overkill???
What I am trying to do is like this.

100 Hz, free running timebase
count up to a predetermined (variable) time. 15 secs MAX (=1500 ticks)?
at timeout, set a flag to do some other stuff.

I have done this using simple PAUSEs but I think accuracy may become an issue.

The program is a bit of a dogs breakfast, but will post it if you like.

What is the simplest way to do the above. BTW, during counting period, absolutely nothing happens except increment counter, so no problem with interrupt time. Am driving an LCD during setup, but will not be required in final.

I got no more hair to pull out, gee it's tuff on us old blokes...

Thanks again.

Melanie
- 12th September 2005, 12:39
Gimme a break... I have trouble remembering how I staggered into work this morning let alone a post from 13 months ago! To save me searching, do you have an easy link?

What are you trying to achieve? Count 15 Seconds then do 'something' and repeat? When you're doing 'something' are you still counting the next 15 second period in the background - or is that suspended? Gee... you can actually get it to last that long? Most guys I know are still in mS...

Kojak resorted to sucking lollipops...

Acetronics2
- 12th September 2005, 13:24
Hi, Muddy

see here : http://www.vermontficks.org/pic_calculations.xls

solution comes with ...

Alain

muddy0409
- 12th September 2005, 14:51
http://www.picbasic.co.uk/forum/showthread.php?t=603 reply #7,9

OK Mel, what I am trying to do is:

do a bunch of stuff (all code OK and works)

press START button
start counter up to 100 - 1500 ticks (1 - 15 secs set by switches during first bunch of stuff)
time out
leave and do another bunch of stuff (all code OK and works)

do not count until start pressed again, and new number of ticks read.
'MY THOUGHTS:
either start the interrupt routine at press START, and stop it at TIMEOUT
or Have interrupt routine free running and zero counter and count to TIME and then go off and do the other stuff.

During the time delay, nothing happens except wait for TIMEOUT

Sorry to ask all these dumb Qs Mel, but seems to me you are the brains in this outfit?

Melanie
- 12th September 2005, 15:14
> Sorry to ask all these dumb Qs Mel, but seems to me you are the brains in this outfit?

Actually there's some pretty clever folks here... and some have been at it for a lot longer than me... as for 'this outfit', I'm not associated with Crownhill (other than being press-ganged into being an Admin on this forum) nor am I associated with MeLabs (though I rather like their PICBasic compiler product).

Gimme a little time to snatch a free moment and revisit the Olympic Timer code...

muddy0409
- 13th September 2005, 06:52
Hi again everyone.
After sleeping on it overnight, and damned uncomfortable it was too, I have decided that a simple PAUSE 15000 would be good enough to give me my 15 sec. maximum time. As long as the accuracy of PAUSE is reasonable it will be good enough. After all, I ain't launching rocketships, just turning pistol targets.
Time to read the manual and check out how good PAUSE is.

Better late than never.
Regards,
Peter