Timer Calculator Application Released!
- marina.petrovic
- Posts: 2986
- Joined: 18 Apr 2013 08:11
Re: Timer Calculator Application Released!
Hi,
You can choose ATXMEGA microcontrolers in Timer Calculator software.
Please, download the latest version of Timer Calculator from LibStock Website:
http://www.libstock.com/projects/view/3 ... calculator
Best regards,
Marina
You can choose ATXMEGA microcontrolers in Timer Calculator software.
Please, download the latest version of Timer Calculator from LibStock Website:
http://www.libstock.com/projects/view/3 ... calculator
Best regards,
Marina
Re: Timer Calculator Application Released!
This version I used above.
Re: Timer Calculator Application Released!
Solved in version 2.6.0.
Hi, I have a question about the results presented by the Timer calculator:
Following is a calculation for a PIC18, 40 Mhz clock frequency, timer0 and 100 ns time (I know, extreme case).
The tool shows the following:
Since the prescaler ia 1:1 the timer input frequency is 10 Mhz (40/4), which makes a timer steptime of 100 ns, so for 100 ns total time only 1 step is needed.
However, the calculated value (0xFE) shows 2 timer steps to interrupt:
0xFE to 0xFF and 0xFF to 0x00, giving a total time of 200 ns in stead of 100 ns.
Since the interrupt occurs on reaching the value 0x00 (overflow of the timer) I would expect a re-load value of 0xFF, which would produce 1 step to interrupt:
0xFF to 0x00, obtaining a total time to interrupt of 100 ns.
Can you have a look at this or explain please?
Thanks in advance!
By the way: great and versatile tool!
Hi, I have a question about the results presented by the Timer calculator:
Following is a calculation for a PIC18, 40 Mhz clock frequency, timer0 and 100 ns time (I know, extreme case).
The tool shows the following:
Code: Select all
//Timer0
//Prescaler 1:1; TMR0 Preload = 254; Actual Interrupt Time : 100 ns
//Place/Copy this part in declaration section
void InitTimer0(){
T0CON = 0xC8;
TMR0L = 0xFE;
GIE_bit = 1;
TMR0IE_bit = 1;
}
void Interrupt(){
if (TMR0IF_bit){
TMR0IF_bit = 0;
TMR0L = 0xFE;
//Enter your code here
}
}
However, the calculated value (0xFE) shows 2 timer steps to interrupt:
0xFE to 0xFF and 0xFF to 0x00, giving a total time of 200 ns in stead of 100 ns.
Since the interrupt occurs on reaching the value 0x00 (overflow of the timer) I would expect a re-load value of 0xFF, which would produce 1 step to interrupt:
0xFF to 0x00, obtaining a total time to interrupt of 100 ns.
Can you have a look at this or explain please?
Thanks in advance!
By the way: great and versatile tool!
Last edited by Dany on 09 Oct 2013 17:03, edited 1 time in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Re: Timer Calculator Application Released!
Hi Dany,
Timer Calculator is still using the wrong formula for interrupt time calculation:This is wrong in many ways:
1. Mathematically - because f, t and PS cannot be zero, hence the minimum value for f * t / (4 * PS) is 1:which is the result you got and we all know that max(TMR0) should be 255.
2. Logically - because the interrupt event occurs on 255-0 transition
The correct formula is:
Regards
Timer Calculator is still using the wrong formula for interrupt time calculation:
Code: Select all
f * t
TMR0 = 255 - ---------
4 * PS
TMR0 = 255 - 40 * 0.1 / 4 = 254
1. Mathematically - because f, t and PS cannot be zero, hence the minimum value for f * t / (4 * PS) is 1:
Code: Select all
min(f * t / (4 * PS)) = 1 => max(TMR0) = 255 - 1 = 254
2. Logically - because the interrupt event occurs on 255-0 transition
The correct formula is:
Code: Select all
f * t
TMR0 = 256 - ---------
4 * PS
Re: Timer Calculator Application Released!
Hi,
Thank you for this analysis, I have passed this to our developers.
Regards,
Filip.
Thank you for this analysis, I have passed this to our developers.
Regards,
Filip.
Re: Timer Calculator Application Released!
Thanks, have downloaded it but still find the data sheet more useful in calculating times because every time I enter a value I wish to calculate, I get an error telling me it is not possible to calculate it.
I used to have another timer calculator that was really useful because it told me the nearest it could get to the value I wanted and allowed me to change parameters and see the effects real time.
I am looking to have a delay between 1 and 2 second and if I select my micro, clock and a timer, entering 1.6 tells me the value for interrupt time is too low? Entering 1.7 tells me there is no solution.
How can the value be too low when I actually know it is too high.
It seems that virtually every value I try produces an error rather than telling me how close it can get to my desired value.
Oh well, back to the data sheet for me.
I used to have another timer calculator that was really useful because it told me the nearest it could get to the value I wanted and allowed me to change parameters and see the effects real time.
I am looking to have a delay between 1 and 2 second and if I select my micro, clock and a timer, entering 1.6 tells me the value for interrupt time is too low? Entering 1.7 tells me there is no solution.
How can the value be too low when I actually know it is too high.
It seems that virtually every value I try produces an error rather than telling me how close it can get to my desired value.
Oh well, back to the data sheet for me.
Re: Timer Calculator Application Released!
this it it, how it should work!
Re: Timer Calculator Application Released!
just saying if I wanted a 60mS timer, it would be nice for the program to tell me it cannot do it and the highest it can give me is 53mS rather than telling me the value I have entered for the interrupt time is too LOW, especially when it I have actually entered a value that is too HIGH for it.
That way I could decide that I would set the interrupt time to 30mS and look for the ISR being serviced twice.
SUGGESTION: How about an additional feature which gives you the interrupt time period range that is possible for the selected parameters. I used to always calculate this and scribble it on the data book (back in the days of paper data books).
That way I could decide that I would set the interrupt time to 30mS and look for the ISR being serviced twice.
SUGGESTION: How about an additional feature which gives you the interrupt time period range that is possible for the selected parameters. I used to always calculate this and scribble it on the data book (back in the days of paper data books).
Re: Timer Calculator Application Released!
I know there is a freeware that can do this in this way!! But I don't know where it ist
This has exactly what you and I want!
But i hope Microe can do it the same way...
This has exactly what you and I want!
But i hope Microe can do it the same way...
-
- Posts: 2
- Joined: 20 Nov 2013 00:59
Re: Timer Calculator Application Released!
I use AVR atmega128, and the timer calculator is a good tool, but I have discovered that TimerCounter0 uses prescaler values up to 7 (for divide by 1024). Shown here are times to counter overflow :
Hz time
' CK0_STOP = 0
' CK0_DIV1 = 1 ' 62500 16 us
' CK0_DIV8 = 2 ' 7812 128 us
' CK0_DIV32 = 3 ' 1953 512 us
' CK0_DIV64 = 4 ' 976 1 ms
' CK0_DIV128 = 5 ' 488 2 ms
' CK0_DIV256 = 6 ' 244 4.1 ms
' CK0_DIV1024 = 7 ' 61 16.4 ms
Because timer calculator uses wrong pre-scale values, the code generated must be changed to get wanted times.
Just for everybodies information
Keep up the great work
Thanks, Peter
Re: Timer Calculator Application Released!
Hi,
Thank you for this observation, I will notify our developers.
Regards,
Filip.
Thank you for this observation, I will notify our developers.
Regards,
Filip.
-
- Posts: 2
- Joined: 20 Nov 2013 00:59
Re: Timer Calculator Application Released!
To update my last, I was using generic ATMEGA x Timers, and this is where my problems happened, missing 6 and 7 prescaler values.
I now find ATMEGA64(A)(L)/128(A), and with this the prescalers is correct.
Was a bit confusing to find, but my fault, and you're GOOD !
Thanks to the developers
Peter
Re: Timer Calculator Application Released!
There is a minor bug on Timer Calculator 2.7.0.0.
I know the use of such low clock frequencies is unusual, but I discovered it when I was testing a project where power saving is important.
The MCU clock frequency values less than 1MHz has a dot as a decimal separator and it causes error. It should be a comma.
Incorrect: Correct:
I know the use of such low clock frequencies is unusual, but I discovered it when I was testing a project where power saving is important.
The MCU clock frequency values less than 1MHz has a dot as a decimal separator and it causes error. It should be a comma.
Incorrect: Correct:
BR
EasyPic6 and registered mkC PRO FOR PIC since 2011
You're never too old to learn something stupid.(PARAPROSDOKIAN)
EasyPic6 and registered mkC PRO FOR PIC since 2011
You're never too old to learn something stupid.(PARAPROSDOKIAN)
Re: Timer Calculator Application Released!
Hi,
Well, the comma or dot using convention differs from language to language.
The English-speaking world uses comma to separate a group of three digits and dot as a decimal point, while the others use this in reverse.
This is why you will get an error if you use comma as a decimal point.
Regards,
Filip.
Well, the comma or dot using convention differs from language to language.
The English-speaking world uses comma to separate a group of three digits and dot as a decimal point, while the others use this in reverse.
This is why you will get an error if you use comma as a decimal point.
Regards,
Filip.
Re: Timer Calculator Application Released!
Hi filip.
I agree and I know that.
But we have to consider 3 things:
1. Or the program is independent of the OS language or
2. It should adapt itself to the OS language, or
3. Some way to inform it which language will be used, independent of the OS language.
But it does not do any of them. At least that's what I think. Maybe I'm wrong.
I am only trying to help, not to complain, as it is a very nice tool and this is a very small issue.
I agree and I know that.
No, I'm getting an error if I use a dot (default) not comma(typed). See the pictures again.filip wrote:This is why you will get an error if you use comma as a decimal point.
But we have to consider 3 things:
1. Or the program is independent of the OS language or
2. It should adapt itself to the OS language, or
3. Some way to inform it which language will be used, independent of the OS language.
But it does not do any of them. At least that's what I think. Maybe I'm wrong.
I am only trying to help, not to complain, as it is a very nice tool and this is a very small issue.
BR
EasyPic6 and registered mkC PRO FOR PIC since 2011
You're never too old to learn something stupid.(PARAPROSDOKIAN)
EasyPic6 and registered mkC PRO FOR PIC since 2011
You're never too old to learn something stupid.(PARAPROSDOKIAN)