资源描述:
《利用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(volatileunsignedint*)0x7001#defineP_
2、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_BaudScalarLow(volatileunsignedint*)0x7024#
3、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=1r";//删除指令signedintdel1[]="AT+CMGD=";//删除指令(用于初始化)sig
4、nedintdel_1=1,del_2=0x31;signedintsend[]="AT+CMGS=";signedintzcd[5],zcd_1,zcd_g,zcd_s;//总长度signedintsendzx[]="02305F01100";signedintsjh[30],sjh_1,sjh_2,sjh_3;//手机号signedintsendxh[]="";signedintdxc[2],dxc_1,dxc_2,dxc_3,dxc_4;//短信长度signedintsendyk[]="5DF25F00003A";//已开:signedintyou_1,y
5、ou_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);voiddelay(signedintd_delay);/*********************************************************************名称:Delay_1ms()*功能:延时
6、子程序,延时时间为1ms*x*输入:x(延时一毫秒的个数)*输出:无***********************************************************************/voiddelay(signedintd_delay){for(d_x=0;d_x<=d_delay;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;}
7、}}/*********************************************************************名称:Readzl()*功能:发送读指令*输入:AT+CMGR=1[回车]*输出:无***********************************************************************/voidReadzl(void){cmd=read;while(*cmd!=' '){while(r!=0x0040){*P_Watchdog_Clear=1;r=*P_UART_Command
8、2;r&=0x0040;