?? receive.lst
字號(hào):
C51 COMPILER V8.02 RECEIVE 07/15/2008 18:31:32 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE RECEIVE
OBJECT MODULE PLACED IN Receive.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Receive.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /*************************************
2 GPS解碼1602顯示程序
3 作者:BG4UVR
4 最后更新:
5 2007.01.27
6 1.2版,改時(shí)間由RMC語(yǔ)句解碼,取消日期顯示
7 2007.01.25
8 1.1版,修正定位后頁(yè)面不能轉(zhuǎn)換的BUG。
9 1.0版,基本功能。
10 ***************************************/
11
12 #include <AT89X51.H>
13 #include <stdio.h>
14 #include "LCD12864_c51.h"
15 char code TIME_AREA= 8; //時(shí)區(qū)
16 //GPS數(shù)據(jù)存儲(chǔ)數(shù)組
17 unsigned char JD[10]; //經(jīng)度
18 unsigned char JD_a; //經(jīng)度方向
19 unsigned char WD[9]; //緯度
20 unsigned char WD_a; //緯度方向
21 unsigned char time[6]; //時(shí)間
22 unsigned char speed[5]; //速度
23 unsigned char high[6]; //高度
24 unsigned char angle[5]; //方位角
25 unsigned char use_sat[2]; //使用的衛(wèi)星數(shù)
26 unsigned char total_sat[2]; //天空中總衛(wèi)星數(shù)
27 unsigned char lock; //定位狀態(tài)
28
29 //串口中斷需要的變量
30 unsigned char seg_count; //逗號(hào)計(jì)數(shù)器
31 unsigned char dot_count; //小數(shù)點(diǎn)計(jì)數(shù)器
32 unsigned char byte_count; //位數(shù)計(jì)數(shù)器
33 unsigned char cmd_number; //命令類型
34 unsigned char mode; //0:結(jié)束模式,1:命令模式,2:數(shù)據(jù)模式
35 unsigned char buf_full; //1:整句接收完成,相應(yīng)數(shù)據(jù)有效。0:緩存數(shù)據(jù)無(wú)效。
36 unsigned char cmd[5]; //命令類型存儲(chǔ)數(shù)組
37
38 //顯示需要的變量
39 unsigned int dsp_count; //刷新次數(shù)計(jì)數(shù)器
40 unsigned char time_count;
41 //bit page;
42 //bit spd_type;
43
44 void sys_init(void);
45 //bit chk_key(void);
46
47 main()
48 {
49 1 unsigned char i;
50 1 char Bhour;
51 1 sys_init();
52 1 while(1){
53 2 if(buf_full==0) //無(wú)GPS信號(hào)時(shí)
54 2 {
55 3 dsp_count++;
C51 COMPILER V8.02 RECEIVE 07/15/2008 18:31:32 PAGE 2
56 3 if(dsp_count>=65000){
57 4 Init_Lcd12864(); //清屏
58 4 ResetCursor(0,2);
59 4 printf("No GPS connect..");
60 4 while(buf_full==0);
61 4 ClearAS();
62 4 dsp_count=0;
63 4 }
64 3 }
65 2 else{ //有GPS信號(hào)時(shí)
66 3 if(buf_full|0x01){ //GGA語(yǔ)句
67 4 // if(lock=='0'){ //如果未定位
68 4 // LCD_write_string(0,0,"*---.--.---- ");
69 4 // LCD_write_string(0,1,"* --.--.---- ");
70 4 // }else{ //如果已定位
71 4 ResetCursor(0,0);
72 4 printf("%c",JD_a);
73 4 // LCD_write_char(0,0,JD_a); //顯示經(jīng)度
74 4 for(i=0;i<3;i++){
75 5 ResetCursor(i+1,0);
76 5 printf("%s",JD);
77 5 // LCD_write_char(i+1,0,JD);
78 5 }
79 4 ResetCursor(4,0);
80 4 printf(".");
81 4 // LCD_write_char(4,0,'.');
82 4 for(i=3;i<10;i++){
83 5 ResetCursor(i+2,0);
84 5 printf("%s",JD);
85 5 // LCD_write_char(i+2,0,JD);
86 5 }
87 4 ResetCursor(0,1);
88 4 printf("%c",JD_a);
89 4 for(i=0;i<9;i++)
90 4 {
91 5 ResetCursor(i+1,0);
92 5 printf("%s",WD);
93 5 }
94 4 // LCD_write_char(0,1,WD_a); //顯示緯度
95 4 // LCD_write_char(1,1,' ');
96 4 // for(i=0;i<2;i++){
97 4 // LCD_write_char(i+2,1,WD);
98 4 // }
99 4 // LCD_write_char(4,1,'.');
100 4 // for(i=2;i<9;i++){
101 4 // LCD_write_char(i+3,1,WD);
102 4 // }
103 4 // }
104 4 // LCD_write_char(14,0,use_sat[0]); //顯示接收衛(wèi)星數(shù)
105 4 // LCD_write_char(15,0,use_sat[1]);
106 4 buf_full&=~0x01;
107 4 dsp_count=0;
108 4 }
109 3 if(buf_full|0x02){ //GSV語(yǔ)句
110 4 // LCD_write_char(14,1,total_sat[0]);
111 4 // LCD_write_char(15,1,total_sat[1]);
112 4 buf_full&=~0x02;
113 4 dsp_count=0;
114 4 }
115 3 if(buf_full|0x04){
116 4 buf_full&=~0x04;
117 4 dsp_count=0;
C51 COMPILER V8.02 RECEIVE 07/15/2008 18:31:32 PAGE 3
118 4 }
119 3 }
120 2 // else{ //頁(yè)面2
121 2 if(buf_full|0x01){ //GGA語(yǔ)句
122 3 buf_full&=~0x01;
123 3 dsp_count=0;
124 3 }
125 2 if(buf_full|0x02){
126 3 buf_full&=~0x02;
127 3 dsp_count=0;
128 3 }
129 2 if(buf_full|0x04){ //RMC語(yǔ)句
130 3 Bhour=((time[0]-0x30)*10+time[1]-0x30)+TIME_AREA;
131 3 if(Bhour>=24){
132 4 Bhour-=24;
133 4 }else if(Bhour<0){
134 4 Bhour+=24;
135 4 }
136 3 ResetCursor(0,2);
137 3 printf("BJT:");
138 3 ResetCursor(4,2);
139 3 printf("%c",Bhour/10+0x30);
140 3 ResetCursor(5,2);
141 3 printf("%c",Bhour%10+0x30);
142 3 ResetCursor(6,2);
143 3 printf(":");
144 3 ResetCursor(7,2);
145 3 printf("%c",time[2]);
146 3 ResetCursor(8,2);
147 3 printf("%c",time[3]);
148 3 // LCD_write_string(2,1,"BJT ");
149 3 // LCD_write_char(6,1,Bhour/10+0x30);
150 3 // LCD_write_char(7,1,Bhour%10+0x30);
151 3 // LCD_write_char(8,1,':');
152 3 // LCD_write_char(9,1,time[2]);
153 3 // LCD_write_char(10,1,time[3]);
154 3 // LCD_write_char(11,1,':');
155 3 // LCD_write_char(12,1,time[4]);
156 3 // LCD_write_char(13,1,time[5]);
157 3 // if(spd_type){
158 3 // LCD_write_string(5,0,"km/h A");
159 3 // }else{
160 3 // LCD_write_string(5,0,"knot A");
161 3 // }
162 3 // if(lock=='0'){ //如果未定位
163 3 // LCD_write_string(0,0,"---.-");
164 3 // LCD_write_string(11,0,"---.-");
165 3 // }else{ //已經(jīng)定位
166 3 // if(spd_type){ //km/h顯示
167 3 // for(i=0;i<5;i++){
168 3 // LCD_write_char(i,0,speed);
169 3 // }
170 3 // }else{ //knot顯示
171 3 // Knots= (((speed[0]-0x30)*1000
172 3 // +(speed[1]-0x30)*100
173 3 // +(speed[2]-0x30)*10
174 3 // +(speed[4]-0x30))*1000)/1852;
175 3 // LCD_write_char(0,0,Knots/1000+0x30);
176 3 // LCD_write_char(1,0,(Knots%1000)/100+0x30);
177 3 // LCD_write_char(2,0,(Knots%100)/10+0x30);
178 3 // LCD_write_char(3,0,'.');
179 3 // LCD_write_char(4,0,Knots%10+0x30);
C51 COMPILER V8.02 RECEIVE 07/15/2008 18:31:32 PAGE 4
180 3 // }
181 3 // for(i=0;i<5;i++){
182 3 // LCD_write_char(11+i,0,angle);
183 3 // }
184 3 }
185 2 buf_full&=~0x04;
186 2 dsp_count=0;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -