资源描述:
《利用gsm模块实现远程无线控制程序》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、#defineP_IOB_Data(volatileunsignedint*)0x7005#defineP_IOB_Buffer(volatileunsignedint*)0x7006#defineP_IOB_Dir(volatileunsignedint*)0x7007#defineP_IOB_Attrib(volatileunsignedint*)0x7008#defineP_IOA_Data(volatileunsignedint*)0x7000#defineP_IOA_Buffer(volatileunsignedi
2、nt*)0x7001#defineP_IOA_Dir(volatileunsignedint*)0x7002#defineP_IOA_Attrib(volatileunsignedint*)0x7003#defineP_UART_Command1(volatileunsignedint*)0x7021#defineP_UART_Command2(volatileunsignedint*)0x7022#defineP_UART_Data(volatileunsignedint*)0x7023#defineP_UART_Baud
3、ScalarLow(volatileunsignedint*)0x7024#defineP_UART_BaudScalarHigh(volatileunsignedint*)0x7025#defineP_Watchdog_Clear(volatileunsignedint*)0x7012//定义变量signedintd_x,d_y,d_z;//延迟signedintb[200],b_1=0;//串口接收数据signedintread[]="AT+CMGR=1r";//读指令signedintdel[]="AT+CMGD
4、=1r";//删除指令signedintdel1[]="AT+CMGD=";//删除指令(用于初始化)signedintdel_1=1,del_2=0x31;signedintsend[]="AT+CMGS=";signedintzcd[5],zcd_1,zcd_g,zcd_s;//总长度signedintsendzx[]="0891683108402305F01100";signedintsjh[30],sjh_1,sjh_2,sjh_3;//手机号signedintsendxh[]="000800";signedi
5、ntdxc[2],dxc_1,dxc_2,dxc_3,dxc_4;//短信长度signedintsendyk[]="5DF25F00003A";//已开:signedintyou_1,you_2,you_3,you_4,dx[20],wu,dx_1;signedintbuf,*cmd,r;signedintbzw,mima=0,chaxun=0;signedintkai,kai_1,guan,guan_1;//voidIRQ7(void)__attribute__((ISR));//voidIRQ7(void);voidde
6、lay(signedintd_delay);/*********************************************************************名称:Delay_1ms()*功能:延时子程序,延时时间为1ms*x*输入:x(延时一毫秒的个数)*输出:无***********************************************************************/voiddelay(signedintd_delay){for(d_x=0;d_x<=d_de
7、lay;d_x++){*P_Watchdog_Clear=1;for(d_y=0;d_y<=d_delay;d_y++){*P_Watchdog_Clear=1;for(d_z=0;d_z<=d_delay;d_z++)*P_Watchdog_Clear=1;}}}/*********************************************************************名称:Readzl()*功能:发送读指令*输入:AT+CMGR=1[回车]*输出:无********************
8、***************************************************/voidReadzl(void){cmd=read;while(*cmd!=' '){while(r!=0x0040){*P_Watchdog_Clear=1;r=*P_UART_Co