GPRS模块调试
最终打样出来的成品如下图:
2、github仓库 代码: https://github.com/echo0110/GPRS-.git
废话不多说 先上代码:
#include “timer.h”
#include “sys.h”
#include “delay.h”
#include “usart.h”
#include “103.h”
#include “led.h”
#include “beep.h”
#include “key.h”
volatile uint8_t i; //47–2017-7-3 19:07
//2017-7-4 16:17
//VNC
int main(void) //
{
u8 t;
u8 len;
u16 times=0;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//
delay_init(168); //
//clearBuff();//
uart_init(115200); //´
//LED_Init(); //
printf("AT\r\n");//
delay_ms(1000);
printf("AT&F\r\n");
delay_ms(1000);
printf("AT+CGCLASS=\"B\"\r\n");
delay_ms(1000);
printf("AT+CGDCONT=1,\"IP\",\"CMNET\"\r\n");
delay_ms(1000);
printf("AT+CGATT=1\r\n");
delay_ms(1000);
printf("AT+CLPORT=\"TCP\",\"2000\"\r\n");
delay_ms(1000);
printf("AT+CIPMODE=1\r\n"); //͸´«
printf("AT+CIPSTART=\"TCP\",\"221.226.69.234\",\"6002\"\r\n"); //
delay_ms(1000);delay_ms(1000);delay_ms(1000);delay_ms(1000);
memset(receBuf, 0, 81);
receCount=0;
while(1)
{
printf(“AT+CIPSTART=“TCP”,“221.226.69.234”,“6002”\r\n”);
// delay_ms(1000);
if(Recevstate==1) //Èç¹ûÊÕµ½Ò»Ö¡Êý¾Ý //receCount=15
{
Recevstate=0;
// i=0;
jieshou_handle();
receCount=0;
}
printf("AT+CIPSTART=\"TCP\",\"123.57.41.13\",\"1005\"\r\n");
// delay_ms(1000);delay_ms(1000);delay_ms(1000);delay_ms(1000);
while(USART_GetFlagStatus(USART2,USART_FLAG_TXE)!= SET);
}
}