|
void __irq Uart2Int(void)
{
unsigned char IntMark;
unsigned char debug[100]="jinru zhong duan!\n";
unsigned char debug0[100]="\nkai shi jie shou \n";
unsigned char debug1[100]="ready\n";
unsigned char debug2[100]="you ka!\n";
unsigned char debug3[100]="wu ka !!\n";
IntMark = U2IIR;
if((IntMark&0x01) == 0)
{
debug_Mes(debug);
if((IntMark & 0x04) == 0x04) //Receive
{
if(uartRecNum2 < recNum2)
{
debug_Mes(debug0);
recData2[uartRecNum2] = U2RBR;
uartRecNum2 = uartRecNum2 + 1;
}
else
{
// debug_Mes(recData2);
uartRecNum2 = 0;
uartSendNum2 = 0;
}
if(recData2[0]=='A'&&recData2[1]=='T'&&recData2[2]=='-'&&recData2[3]=='C') /*判断是否出去ready状态*/
{
state=1;
debug_Mes(recData2);
debug_Mes(debug1); /* ready*/
uartRecNum2 = 0;
}
else if(recData2[0]=='%'&&recData2[1]=='T'&&recData2[2]=='S'&&recData2[3]=='I'&&recData2[4]=='M')
{
if(recData2[6]=='1')
{
state=2;
debug_Mes(debug2); /*有SIM卡*/
}
else
state=3;
debug_Mes(debug3); /*无SIM卡*/
uartRecNum2 = 0;
}
if(state==1)
{
find_SIM();
}
else if (state== 2)
{
send_Ms(num,mess);
}
}
}
VICVectAddr = 0x00; /*向量地址寄存器*/
}
/**************************************************************
名称: 调试信息打印程序
入口参数: 字符串数组
出口参数: 无
**************************************************************/
void debug_Mes(unsigned char debug_ms[100])
{
int i;
for(i=0;i<100;i++)
{
U0THR= debug_ms;
while ((U0LSR & 0x20) == 0); /*查询是否发送完毕*/
}
}
|
|