[mw_shl_code=c,true]/**************************串口发送指令**********************************/
void send_message(void)
{
uchar i;
Init_uart0();
_EINT();
while(1)
{
if(flag==1)
{[/mw_shl_code]
[mw_shl_code=c,true] Uart0Sends(a);//返回gsm模块的值给串口[/mw_shl_code]
[mw_shl_code=c,true]
[mw_shl_code=c,true] Uart0Sends(at);//发送任意数组给串口调试助手[/mw_shl_code]
[/mw_shl_code]
[mw_shl_code=c,true] flag=0;
}
}[/mw_shl_code]
[mw_shl_code=c,true]/**************************串口接收中断**********************************/
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
while (!(IFG2&UCA0RXIFG)); // USCI_A0 TX buffer ready? 等待TX buffer为空
IFG2&=~UCA0RXIFG; //清楚中断标志位
flag=1;
uchar *p;
p=a;
do{
*p =UCA0RXBUF; // TX -> RXed character 发送接收到是数据
p++;
}
while(*p!='\0');
P1DIR|=BIT0; //中断指示灯
P1OUT^=BIT0;
}[/mw_shl_code]
串口调试助手发送指令给gsm模块,430中断接收模块返回的值,再发送给串口调试助手,但是再发送任意数组给串口调试助手,显示的数据就会乱掉,求原因啊.... |