how to preload a timer value ... how to get actual time ??

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
zenzehar
Posts: 21
Joined: Sat Nov 01, 2008 4:00 pm

how to preload a timer value ... how to get actual time ??

Post by zenzehar »

How to get actual time from a timer ... let's say that i want to raise some event after 15 minuite ... how could this be achieved ... may any one please give an example for this ... i want an explanation because i couldn't understand examples in folwcode examples directory ... please give me a brief explanation for the 15 min. timer ... thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: how to preload a timer value ... how to get actual time ??

Post by Benj »

Hello

The timer interrupt is basically a interrupt that will happen at a given frequency. You can change this frequency by editing the interrupt properties using the interrupt enable flowchart icon. The length of time you wish to wait is dependant on how many interrupt you require at the given frequency.

For example if your interrupt is set to interrupt at 75hz then you will have to wait for 75 interrupts to occur before a second has passed. To do this you can increment a variable in your interrupt macro. If the variable has reached a certain value eg 75 for a second @ 75hz then you can clear the variable and perform some function eg updating seconds, minutes and hour variables. This is how the digital clock example works.

To wait for 15 minutes you would have to wait (15 * (60 * Interrupt frequency)) interrupt cycles. For longer delays like this it is better to get the interrupt running as slowly as possible so you are not taking too much processor time away from the main task. Also this means lower count values.

To count or compare values higher then 255 you must use the INT variable type.

Hope this helps.

Post Reply