Pari Boopathy
Newbie level 6
- Joined
- Mar 13, 2014
- Messages
- 14
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 94
how to calculate the timer value for 9ms of bit with internal 16Mhz oscillator?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
here for almost all current mcu today
https://www.mikroe.com/timer-calculator/
but you did not specify your mcu, nor the language you use ?
//Timer0 Prescaler :2; Preload = 48000; Actual Interrupt Time = 9 ms; Mode: 16bit
//Place/Copy this part in declaration section
void InitTimer0A(){
SYSCTL_RCGCTIMER_R0_bit = 1;
EnableInterrupts();
TIMER_CTL_TAEN_bit = 0;
TIMER0_CFG = 4;
TIMER0_TAMR |= 2;
TIMER0_TAPR = 2;
TIMER0_TAILR = 48000;
NVIC_IntEnable(IVT_INT_TIMER0A_16_32_bit);
TIMER_IMR_TATOIM_bit = 1;
TIMER_CTL_TAEN_bit = 1;
}
void Timer0A_interrupt() iv IVT_INT_TIMER0A_16_32_bit {
TIMER_ICR_TATOCINT_bit = 1;
//Enter your code here
}