main函数如下:
int main (void)
{
PORTB_PCR10= PORT_PCR_MUX(1);
PORTB_PCR7= PORT_PCR_MUX(1);
SIM_SOPT2|=SIM_SOPT2_TPMSRC(1);
SIM_SCGC6|=SIM_SCGC6_TPM0_MASK;
TPM0_SC=TPM_SC_PS(7)|TPM_SC_CMOD(1)|TPM_SC_TOIE_MASK;
TPM0_CNT=TPM_CNT_COUNT(65000);
TPM0_MOD=TPM_MOD_MOD(37500);
printf("\nRunning the Test_TPM0_Interrupt_again project.\n");
while(1)
{
GPIOB_PDDR =GPIO_PDDR_PDD(0x400);
printf("SET GPIOB_PDDR");
delay_time(5500);
printf("delay_time!");
GPIOB_PDDR =GPIO_PDDR_PDD(0x00);
delay_time(5500);
printf("\nRunning the Test_TPM0_Interrupt_again project:while().\n");
enable_irq(33-16);
printf("while(1) executed");
}
}
然后enable_irq()运行后,主函数不能printf("while(1) executed");需要等中断执行完后,才打印!
请问这是什么原因? |