Page 1 of 6

Timer Calculator Application Released!

Posted: 25 Jul 2012 16:42
by anikolic
Timer Calculator Application Released!

We developed a small but very handy application which creates code for Timer Interrupts on 8-bit
PIC microcontrollers. We call it Timer Calculator.

Image

Timer Calculator is a tool which creates code for timer interrupts. All you have to do is set your
microcontroller family, clock frequency and available timer, and simply specify which period you
would like the timer to run at. Clicking on the button Calculate will create code for mikroC,
mikroBasic and mikroPascal compilers for PIC.

We have provided dozens of most commonly used configuration templates that can be loaded
with a single click. All you have to do is copy the generated code and paste it into your compiler's editor.

Timer Calculator is exclusively shared on Libstock website, and we hope that you will like it as
much as we do. It really saves you time because you don't have to browse through the datasheets
and calculate register values, or worry about activating interrupts the right way.
That's why this tool is awesome for PIC developers.

Yours sincerely,
mikroElektronika

Re: Timer Calculator Application Released!

Posted: 25 Jul 2012 17:03
by Jack Flanders
This looks useful! I see there are two download files: one is a .rar and one is a .zip and since I use Windows, I chose the zip file. Unfortunately, it has a rar file inside.

What is the correct application to extract the Timer Calculator Application from this?

Re: Timer Calculator Application Released!

Posted: 25 Jul 2012 17:28
by Limba
I recommend to use 7-zip in windows.

Re: Timer Calculator Application Released!

Posted: 25 Jul 2012 17:57
by Jack Flanders
Thank you! That worked for me.

Re: Timer Calculator Application Released!

Posted: 25 Jul 2012 19:30
by p.erasmus
mE thank you very much for this last two usefull tools !

Re: Timer Calculator Application Released!

Posted: 25 Jul 2012 19:30
by Dany
Very handy tool, thanks!! :D :D

Re: Timer Calculator Application Released!

Posted: 26 Jul 2012 09:08
by chimimic
Very usefull, thanks ! :D
Just a little error message about config file on startup, but seems works as expected.
Remy

Re: Timer Calculator Application Released!

Posted: 26 Jul 2012 13:30
by janni
This is certainly a useful tool :) , especially for beginners.
chimimic wrote:Just a little error message about config file on startup,
Yes, that's something that should be corrected - when Windows localisation leads to decimal dot replaced with comma, there's the "Invalid timer config file" error for files coming with the calculator. Replacing decimal dots in numerical fields in config files removes the error, but, naturally, the program shouldn't be sensitive to localisation.

There are also some small things that could be corrected, like unneeded reloading of PR2 register in Timer 2 ISR, or (rounding?) errors leading to inaccurate number of counts (for example, PR2=248 for 1ms with Fosc=4MHz, to stay with Timer2). (There's also missing postscaler value in description for Timer2.)

There are some fine points to timers's reloading, of which the best known is skipping of two instruction cycles before resuming counting after loading Timer0 registers. Unfortunately, at an attempt to include it, the calculator makes things worse. First, to compensate, the count should be decreased, not increased, and second, count may be so compensated (count per instruction cycle) only when prescaler is not used.

I'm not sure compensation of the subtleties does any good when larger errors in timing, like those caused by the ISR overhead are neglected. Some pointers in Help file about the latter would be in place, BTW.

Re: Timer Calculator Application Released!

Posted: 27 Jul 2012 11:22
by janko.kaljevic
Hello,

Thanks for the reporting.
It will be fixed as soon as possible.

Best regards.

Re: Timer Calculator Application Released!

Posted: 31 Jul 2012 12:18
by marko.curcic
@janni

Hi,

Thanks for reporting the bugs. New version of application will be published on LIbstock soon.
About compensation, did you mean increasing the value written to TMR0? Because, if you decrease the value written to TMR0, timer interrupt will be longer for that time period. Just curious about your statetment.

Best regards

Re: Timer Calculator Application Released!

Posted: 31 Jul 2012 13:32
by janni
Hi Marko,
About compensation, did you mean increasing the value written to TMR0?
Yes, I meant increasing value written to registers, i.e. decreasing the count for timer (it's easier, at least for me, to think what timer has to count, than what has to be written to registers :) , which equals 65536-count).

Re: Timer Calculator Application Released!

Posted: 02 Aug 2012 16:35
by cclinus
Hi,

Below is the code generate by Timer Calculator. I wonder why PR2 is 248 but not 249.

Code: Select all

//Timer2
//Prescaler 1:4; Postscaler 1:12; TMR2 Preload = 248; Actual Interrupt Time : 1 ms
 
//Place/Copy this part in declaration section
void InitTimer2(){
  T2CON	 = 0x5D;
  TMR2IE_bit	 = 1;
  PR2		 = 248;
  INTCON	 = 0xC0;
}
 
void Interrupt(){
  if (TMR2IF_bit){ 
    //TODO: Enter your code here
    TMR2IF_bit = 0;
    PR2	 = 248;
  }
}
Regards

Re: Timer Calculator Application Released!

Posted: 02 Aug 2012 16:55
by janni
cclinus wrote:Below is the code generate by Timer Calculator. I wonder why PR2 is 248 but not 249.
It shouldn't, but this was already pointed out :wink: .

Re: Timer Calculator Application Released!

Posted: 11 Aug 2012 15:00
by OlliD
Really handy application. Thanks for providing it, Janko!

Cheers,
Olli

Re: Timer Calculator Application Released!

Posted: 13 Aug 2012 05:53
by Frank73
hello I want to congratulate you for this excellent tool allows us to go faster in our developments is made to order.
good until yesterday I started to speak I have a question, etoy trying to read the pulse count in a given period, but I have clear the way I write the data on screen, I mean how do I load the value of pulse a bariable to see her on screen so I am not clear that part!