发表于 2007/8/25 20:43:23
朋友写了个 GPS 模块的程序,转来给大家看看
bit ReceivingF = 0;
bit EndF = 0;
bit NewByteF="0";
uchar GPS_time[9]; //UTC 时间
uchar GPS_wd[11]; //纬度
uchar GPS_jd[12]; //经度
uchar GPS_warn; //定位警告
uchar GPS_status; //定位状态
uchar GPS_alt[8]; //海拔
uchar GPS_sv[3]; //使用卫星
uchar GPS_speed[6]; //速度
uchar GPS_date[9]; //UTC 日期
uchar Segment; //逗号计数
uchar Bytes_counter;
uchar Command;
uchar tmp;
void uart(void) interrupt 4
{
if(RI)
{
tmp = SBUF;
NewByteF = 1;
RI = 0;
return;
}
}
void gps(void)
{
if(tmp == '$')//起始标志
{
ReceivingF = 1;
Bytes_counter = 0;