求高手赐教,有什么问题
#include <SIM300.h>#include <reg51.h>
#include <string.h>
#include <gps.h>
void dis_time()
{
unsigned char hh;
unsigned char i,temp_buff[10];
hh=(gps_time[0]-'0')*10+(gps_time[1]-'0');
hh+=8; //将格林威治时间校正成北京时间
if(hh>=24)
hh-=24; //校正小时
temp_buff[0]=hh/10+'0';
temp_buff[1]=hh%10+'0';
temp_buff[2]=':';
temp_buff[3]=gps_time[2];
temp_buff[4]=gps_time[3];
temp_buff[5]=':';
temp_buff[6]=gps_time[4];
temp_buff[7]=gps_time[5];
for(i=0;i<8;i++)
gps_time[i]=temp_buff[i];
LCD_write_english_string(0,0,"TIME");
LCD_set_XY(36,0);
for(i=0;i<8;i++)
{
LCD_write_char(gps_time[i]);
}
}
void dis_jwdu()
{
unsigned i;
LCD_set_XY(0,1);LCD_write_char(gps_latitude_dir);
LCD_set_XY(24,1);
for(i=0;i<10;i++)
{
LCD_write_char(gps_latitude[i]);
}
LCD_set_XY(0,2);LCD_write_char(gps_longitude_dir);
LCD_set_XY(30,2);
for(i=0;i<9;i++)
{
LCD_write_char(gps_longitude[i]);
}
}
void dis_high()
{
unsigned i;
LCD_write_english_string(0,5,"HIGH");
LCD_set_XY(42,5);
for(i=0;i<7;i++)
{
LCD_write_char(gps_height[i]);
}
}
/*gprs_data()
{
unsigned char buff[40];
unsigned i;
}*/
//声明GPS驱动部分的全局变量
void delay_time(unsigned char t)
{
unsigned int i,n;
for(n=0;n<t;n++)
for(i=0;i<10000;i++);
}
void main(void)
{
LCD_init(); //LCD初始化
LCD_write_english_string(0,0,"System Starting and Initializing......");
Delay_ms(5000);
sys_init(); //UART1初始化
Init_GPS_module(); //GPS初始化
// BELL_UP(); //BEEP
Start_GSM(); //开启模块
GSM_init(); //GSM初始化
clear_SystemBuf(); //清除串口1缓冲区数据
while(strsearch("Call Ready",SystemBuf)==0);//等待模块准备好
BELL_UP();
do
{
LCD_clear();
clear_SystemBuf();
sendstring(AT_COPS);
LCD_write_english_string( 4,2,"searching>");
Delay_ms(3000);
LCD_write_english_string( 4,2,"searching->");
Delay_ms(3000);
LCD_write_english_string( 4,2,"searching-->");
Delay_ms(3000);
LCD_write_english_string( 4,2,"searching--->");
Delay_ms(3000);
}while((strsearch("CHINA UN",SystemBuf)==0)&&(strsearch("CHINA MOBILE",SystemBuf)==0));//检测服务商信息
BELL_UP();
LCD_clear();
LCD_write_english_string(0,0,"KinCony");
//GPRS初始化
sendstring(AT_CDSNORIP);Delay_ms(5000);
sendstring(AT_CIPHEAD); Delay_ms(5000);
sendstring(AT_CIPSTART);
//while(strsearch("CONNECT OK",SystemBuf)!=0);
BELL_UP();
LCD_clear(); //清屏幕
ET0=1; //开中断
ET1=1;
while(1)
{
Delay_ms(50000);Delay_ms(5000);
Delay_ms(5000);Delay_ms(5000);
if(gps_data_ok_flag) //查询GPS数据是否OK
{
IE2=0x00; //如果OK就关中断处理数据并显示数据
dis_time();
dis_jwdu();
dis_high();
gps_data_ok_flag=0;
IE2=0x01;
}
if(send_flag==1)
{
sendstring(AT_CIPSEND);
Delay_ms(5000);
Delay_ms(5000);
sendchar(0x49);
sendchar(0x61);
sendchar(0x6D);
sendchar(0x44);
sendchar(0x4C);
sendchar(0x59);
Delay_ms(5000);
Delay_ms(5000);
sendchar(0x1a);
send_flag == 0 ;
}
}
for(s=0;s<9;s++)
sendstring(AT_CIPSEND);
Delay_ms(5000);
Delay_ms(5000);
sendchar(0x73);
while(strsearch("Hello",SystemBuf)==0);
BELL_UP();
}
/********************************************************************************************************
** 函数名称 Int_Timer0()
** 函数功能 定时器中断位,是整个程序的心跳,如果停止,程序会死机
*********************************************************************************************************/
void Int_Timer0(void) interrupt 1 using 3
{
unsigned char i;
TH0 = 0xB8;
TL0 = 0x00; //20ms的时钟基准
timer_1S_cnt++;
timercount++;
EA=0;
if(timer_1S_cnt==50) //20×50=1000M
{
timer_10S_cnt++;
timer_1S_cnt=0;
timer_S_cnt++;
} //1秒=1000毫秒
/*if(timer_10S_cnt==10) //10S
{
timer_10S_cnt=0;
// BELL_UP();
sendstring(AT_CIPSEND);
for(i=0;i<8;i++)
{
sendchar(gps_time[i]);
}
sendchar(gps_latitude_dir);
for(i=0;i<10;i++)
{
sendchar(gps_latitude[i]);
}
sendchar(gps_longitude_dir);
for(i=0;i<9;i++)
{
sendchar(gps_longitude[i]);
}
for(i=0;i<7;i++)
{
sendchar(gps_height[i]);
}
sendchar(0x1a);
} */
EA=1;
}