32614_1489253935 0 Posted January 19, 2014 Share Posted January 19, 2014 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); TimerLoadSet(TIMER0_BASE, TIMER_A, 60000); How to calculate the values of each timer ? Thanks Dear! Quote Link to post Share on other sites
morry 0 Posted January 20, 2014 Share Posted January 20, 2014 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. bluehash 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.