43oh

# Distinguish between TimerPrescaleSet vs TimerLoadSet

## Recommended Posts

Hi everyone,

Im a newbie so I have a trouble,

How to distinguish between TimerLoadSet and TimerPrescaleSet

I have seen a example which timer configured :

TimerPrescaleSet(TIMER0_BASE, TIMER_A, 500);

How to calculate the values of each timer ?

Thanks Dear!

##### Share on other sites

Hi!

Prescaler (in simple words) means that the clock driving your Timer is divided by 500 - your timer counts 500 times slower than the system clock speed.

Let's assume a system clock of 80Mhz: 80Mhz / 500 = 160kHz  --> 1/160kHz = 6,25µs for one counter step.

Your Timer is loaded with a start value of 60000 and counts down to 0.

So you have 60000 steps * 6,25µs = 0.375s - that is your timer period for one full count from 60000 downto 0.

Or as equation - easy to adapt for different values of Prescaler, TimerLoad and System Clock:

TimerPeriod = 60000 * 500 / 80MHz.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
• Blog

• #### Activity

×
• Create New...