void cpu_timer0_init()
{
myPie = (PIE_Handle)PIE_BASE_ADDR;
myTimer0 = (TIMER_Handle)TIMER0_BASE_ADDR;
PIE_registerPieIntHandler(myPie, PIE_GroupNumber_1, PIE_SubGroupNumber_7, (intVec_t)&cpu_timer0_isr);
TIMER_stop(myTimer0);
TIMER_setPeriod(myTimer0, time);//time的参数决定定时时常=time/60*1000000
TIMER_setDecimationFactor(myTimer0, Prescaler);//Timer Prescaler Register
TIMER_reload(myTimer0);
//TIMER_setEmulationMode(myTimer0, TIMER_EmulationMode_StopAfterNextDecrement);
TIMER_enableInt(myTimer0);
TIMER_start(myTimer0);
// Enable TINT0 in the PIE: Group 1 interrupt 7
PIE_enableInt(myPie, PIE_GroupNumber_1, PIE_InterruptSource_TIMER_0);
}
|
|