|
51单片机在外部中断0服务程序中,如何用串口中断??
[复制链接]
51单片机在外部中断0服务程序中,如何用串口中断??
我写的程序有问题吗?为什么我在外部中断0程序中不能用串口中断???
- int main(void)
- {
- while(1);
- return 0;
- }
- //外部中断0
- void INT0_Interrput(void) interrupt 0
- {
- EX0 = 0; //关中断
- Init_Display3();
- Delay1ms(1000);
- Usart1_SendString("AT+CLIP=1\r\n");
- Delay1ms(1000);
- Receive_Count = 0;
- memset( Usart_Receive, 0x00, sizeof(Usart_Receive) );
- Init_Display4();
- Init_Display3();
-
- while(1)
- {
- Beep();
- Gsm_CallInCheck();
- }
- EX0 = 1;//开中断
- }
- //串口中断
- void Usart1_Interrupt(void) interrupt 4
- {
- if (RI)
- {
- RI = 0;
- Usart_Receive[Receive_Count] = SBUF;
- Receive_Count++;
- if (Receive_Count >= BUF_SIZE)
- {
- Receive_Count = 0;
- }
- }
- }
复制代码
|
|