Page 1 of 1

timer

Posted: Sat Jun 26, 2010 8:40 am
by aerofrick
Hi,
I am trying to make a watch with witch I would control relays. This relays would change position with time and with temperature, but I came across a problem.

I am still a beginner in Flowcode, but I am a quick learner. At first I wanted to use for clock real time clock chip but I am not very good with communication so I decided to use one of the timers in my pic (16F1937). I quickly saw that if I use for my clock the same timer as for the main program that I will have different lengths of seconds.

I don’t need this clock to be as accurate as the real time clock, because the relays are meant to change position according to minutes, hours… but not seconds.

So what I really want to know is weather in Flowcode I can put the macro with the clock on to another timer?

Jan

Re: timer

Posted: Sat Jun 26, 2010 11:20 am
by Sean
Hello,

One of the MIAC example programs, 'CLOCK1' (available for download from our website), contains a real-time HH:MM:SS clock managed by a 'tick' interrupt from one of the internal timers - accurate to a few seconds a day with a suitable crystal.

Interrupt timing is not affected by operations in your main program.

The interrupt handler macro should operate with any other target device and from any available timer. Some of the values and interrupt setup might need to change, depending on the clock frequency of your system.

The original vaues are for a 48MHz xtal and use TMR0 with a prescaler of 1:16.