Hi all,
I have a fault with my code, i find the line that got program into hard fault.
Here is my program, could u guy pls help me fix the problem. THANKS
void Timer1IntHandler(void) //1s calculate rpm, output pwm { TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT ); PWMGenDisable(PWM0_BASE, PWM_GEN_3); // IN DEBUG I FIND OUT THIS LINE CAUSE FAULT ISR pulse_count = TimerLoadGet(WTIMER0_BASE, TIMER_B)-TimerValueGet(WTIMER0_BASE, TIMER_B); rpm = 60*pulse_count/(334); TimerLoadSet(WTIMER0_BASE, TIMER_B,10000000); UpdatePID(); PWMPulseWidthSet(PWM0_BASE, PWM_OUT_6,Output); PWMGenEnable(PWM0_BASE, PWM_GEN_3); }