cancel
Showing results for 
Search instead for 
Did you mean: 

Regardding timer_count calculation

bbbodekar
Associate II
Posted on July 16, 2003 at 07:43

Regardding timer_count calculation

4 REPLIES 4
joseph2399
Associate II
Posted on May 17, 2011 at 11:54

uPSD has a standard 8032 MCU build in. I am not sure exactly where the ''-17L'' came from either, however I found the same equation from one of the Application notes on KEIL's website. Please see the app. note at:

http://www.keil.com/appnotes/files/apnt_105.pdf

bbbodekar
Associate II
Posted on May 17, 2011 at 11:54

Hello Friends,

I am a new member and have a DK3200 dev. kit.

I was going through the sample codes for timer0, where the time_count is calculated as -

0x10000 - ( ( FREQ_OSC * Period ) / 12L - 17L )

I am stuck up with the factor '17L' as to where it comes from.

Kindly let me know its significance.

Regards,

Bhushan.
chris_baragnon
Associate II
Posted on May 17, 2011 at 11:54

Hello!

I think that ''17L'' it's only to allows problem of memory size. In fact ''L'' put the value 17 in Long type.

I hope I help you.

sorry for the english mistake.

totof.
bbbodekar
Associate II
Posted on May 17, 2011 at 11:54

Dear Friends,

Moderator gave me the link to the Keil app. note. And accordingly i contacted Keil support for the same.

They say that the factor 17L comes from the code overhead which is involved in the update of the timer registers. It is determined by executing the code in the uVision2 simulator, which provides accurate timing. To avoid such constants, try using the auto reload mode.

Regards,

Bhushan.