Page 1 of 1

Timer

Posted: Thu Apr 01, 2010 8:11 pm
by jgu1
Hi!

Can anybody help me. I want to make a timer, not a wait. I am making a program where I am using Macro´s. But every 5 minute I want to set a flag so I am able to enable a Macro. I have already used one interrupt with timer0.

Is it possible to make a timer witch run wihtout interrupt, and please without C code?

Thanks i advance.

Best regard

Jørgen

Re: Timer

Posted: Fri Apr 02, 2010 8:45 am
by medelec35
Interrupts are used for a timer if your program is required to do other things whilst timing is carried out.

If you want a 5 minute non-interrupt timer, so program justs waits until time period has elapsed then try this way:
http://www.matrixmultimedia.com/mmforum ... =26&t=6967

If it was me and I would like to keep setting a flag every 5 minutes and performing other functions then I would use timer 1, since already using timer 0.

Re: Timer

Posted: Sun Apr 04, 2010 6:41 pm
by Albert38
If you already used timer0, you know the frequentie on witch this timer0 works. Just add a counter to it and place the routine you want to run every 5 minutes behind a "if" before this "if" you make a calculation "{LV} = Counter MOD {the number of times your timer0 is run in 5 minutes}" Now the "if" has to go true loop "yes" when the {LV} is 0

Re: Timer

Posted: Sun Apr 04, 2010 8:31 pm
by jgu1
Hi!

Thank you both of you. I will try.

Regard
Jørgen.

Re: Timer

Posted: Mon Apr 05, 2010 2:01 pm
by medelec35
Albert38 wrote:If you already used timer0, you know the frequentie on witch this timer0 works.
That is a good point!
You said your already using int0, here is how you can utilise timer 0 to have a 2, 3 and 5 minute timer simultaneously. I have also included a Minute variable to set for how ever minutes you like.
You can also add as many different timers as you like.

Re: Timer

Posted: Thu Apr 15, 2010 7:05 pm
by jgu1
Thank you Albert38. Very good examble, it works

Regard

Jørgen :P