按照楼主的教程,进TIMER_A1_VECTOR中断应该是TAIFG(TAR 计数器溢出)以及CCR1,CCR2…… ;进TIMER_A1_VECTOR应该是CCR0 。但是我的程序(如下):
void Timer3_A2_graceInit(void)
{
/* Struct to pass to Timer_A_initUpMode */
Timer_A_initUpModeParam initUpParam = {0};
/* USER CODE START (section: Timer3_A2_graceInit_prologue) */
/* User initialization code */
/* USER CODE END (section: Timer3_A2_graceInit_prologue) */
/* Initialize TimerA in up mode */
initUpParam.clockSource = TIMER_A_CLOCKSOURCE_ACLK; //32.768kHZ
initUpParam.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1;
initUpParam.timerPeriod = 327;
initUpParam.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_ENABLE;
initUpParam.captureCompareInterruptEnable_CCR0_CCIE = TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE;
initUpParam.timerClear = TIMER_A_SKIP_CLEAR;
initUpParam.startTimer = false;
Timer_A_initUpMode(TIMER_A3_BASE, &initUpParam);
/* Start TimerA counter */
Timer_A_startCounter(TIMER_A3_BASE, TIMER_A_UP_MODE);
/* USER CODE START (section: Timer3_A2_graceInit_epilogue) */
/* User code */
/* USER CODE END (section: Timer3_A2_graceInit_epilogue) */
}
#pragma vector=TIMER3_A0_VECTOR
__interrupt void TIMER3_A0_ISR_HOOK(void)
{
/* USER CODE START (section: TIMER3_A0_ISR_HOOK) */
/* replace this comment with your code */
/* USER CODE END (section: TIMER3_A0_ISR_HOOK) */
}
/*
* ======== Timer3_A2 Interrupt Service Routine ========
*/
#pragma vector=TIMER3_A1_VECTOR
__interrupt void TIMER3_A1_ISR_HOOK(void)
{
/* USER CODE START (section: TIMER3_A1_ISR_HOOK) */
/* replace this comment with your code */
/* USER CODE END (section: TIMER3_A1_ISR_HOOK) */
Timer_A_clearTimerInterrupt(TIMER_A3_BASE);
GPIO_toggleOutputOnPin(GPIO_PORT_P3,GPIO_PIN4);
}
P3.4输出的波形
是我需要的10MS定时这是怎么回事呢!