初级会员

- 积分
- 110
- 金钱
- 110
- 注册时间
- 2013-7-15
- 在线时间
- 0 小时
|
本人使用代码如下:
中断服务程序:设置了外中断7先占优先级为1,但是 程序运行到delay_ms(200);出就不懂了,额。。。MAIN函数中 可以使用的。。难道是因为Systick没有清楚中断标志位??
void EXTI9_5_IRQHandler(void) /* TouchScreen */
{
if(EXTI_GetITStatus(EXTI_Line7) != RESET)
{
//printf("\n\r tp");
// ARMJISHU_TouchScreen_ADS7843();
delay_ms(200);//每次调到这里 貌似就卡住了。。。
temp=temp+1;
sprintf(buf,"%f",temp);
GUI_Text2(Line1 ,0,(u8*)buf,White,Red);
/* Clear the EXTI Line 5 */
EXTI_ClearITPendingBit(EXTI_Line7);
}
}
Systick ms延时程序:
/*******************************************************************************
* Function Name: Delay
* Description : Inserts a delay time.
* Input : nCount: specifies the delay time length (time base 1 ms).
* Output : None
* Return : None
*******************************************************************************/
void delay_ms(u32 nCount)
{
NVIC_SetPriority(SysTick_IRQn, 0); //设置先占优先级为0
TimingDelay = nCount;
/* Enable the SysTick Counter */
if(SysTick_Config(SystemFrequency/1000))
{
while(1);
}
while(TimingDelay != 0)
{
}
SysTick->CTRL &= SysTick_Counter_Disable;
SysTick->VAL = (0x00);
//NVIC_SetPriority(SysTick_IRQn,0);
} |
|