⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1602gps.lst

📁 基于51单片机与GPS系统的智能坦克车源代码+PROTUES仿真+电路图。欢迎下载~
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V6.23a  1602GPS                                                               06/16/2008 13:14:49 PAGE 1   


C51 COMPILER V6.23a, COMPILATION OF MODULE 1602GPS
OBJECT MODULE PLACED IN 1602gps.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE 1602gps.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          /*************************************
   2              SUPER TANKING显示程序
   3              作者:
   4          ***************************************/
   5          
   6          //线路连接见技术报告内原理图
   7          
   8          #include <reg51.h>
   9          #include "1602.h"
  10          
  11          sbit SPD_TYPE=P2^3;
  12          sbit KEY1=P2^4;
  13          
  14          /*
  15          sbit GPS_SPD=P1^4;
  16          sbit KEY1=P1^6;
  17          sbit SPD_TYPE=P1^5;
  18          */
  19          
  20          
  21          char code TIME_AREA= 8;            //时区
  22          
  23          //GPS数据存储数组
  24          unsigned char JD[10];            //经度
  25          unsigned char JD_a;            //经度方向
  26          unsigned char WD[9];            //纬度
  27          unsigned char WD_a;            //纬度方向
  28          unsigned char time[6];        //时间
  29          unsigned char speed[5];        //速度
  30          unsigned char high[6];        //高度
  31          unsigned char angle[5];        //方位角
  32          unsigned char use_sat[2];        //使用的卫星数
  33          unsigned char total_sat[2];    //天空中总卫星数
  34          unsigned char lock;            //定位状态
  35          
  36          //串口中断需要的变量
  37          unsigned char seg_count;        //逗号计数器
  38          unsigned char dot_count;        //小数点计数器
  39          unsigned char byte_count;        //位数计数器
  40          unsigned char cmd_number;        //命令类型
  41          unsigned char mode;                //0:结束模式,1:命令模式,2:数据模式
  42          unsigned char buf_full;            //1:整句接收完成,相应数据有效。0:缓存数据无效。
  43          unsigned char cmd[5];            //命令类型存储数组
  44          
  45          //显示需要的变量
  46          unsigned int dsp_count;        //刷新次数计数器
  47          unsigned char time_count;
  48          bit page;
  49          bit spd_type;
  50          
  51          void sys_init(void);
  52          bit chk_key(void);
  53          
  54          main()
  55          {
C51 COMPILER V6.23a  1602GPS                                                               06/16/2008 13:14:49 PAGE 2   

  56   1          unsigned char i;
  57   1          char Bhour;
  58   1          unsigned int Knots;
  59   1          sys_init();
  60   1      
  61   1          while(1){
  62   2      
  63   2              if(buf_full==0)                //无GPS信号时
  64   2              {
  65   3                  dsp_count++;
  66   3                  if(dsp_count>=65000){
  67   4                      LCD_cls();            //清屏
  68   4                      LCD_write_string(0,0,"No GPS connect..");
  69   4                      while(buf_full==0);
  70   4                      LCD_cls();    
  71   4                      dsp_count=0;
  72   4                  }
  73   3              }
  74   2              else{                        //有GPS信号时
  75   3                  if(chk_key()){                //检测到按键切换显示
  76   4                      page=!page;
  77   4                      LCD_cls();
  78   4                  }
  79   3      
  80   3                  if(!page){                        //页面1
  81   4                      if(buf_full|0x01){                //GGA语句
  82   5                          if(lock=='0'){                    //如果未定位
  83   6                              LCD_write_string(0,0,"*---.--.----  ");
  84   6                              LCD_write_string(0,1,"* --.--.----  ");                    
  85   6                          }else{                            //如果已定位
  86   6                              LCD_write_char(0,0,JD_a);            //显示经度
  87   6                              for(i=0;i<3;i++){
  88   7                                  LCD_write_char(i+1,0,JD[i]);
  89   7                              }
  90   6                              LCD_write_char(4,0,'.');
  91   6                              for(i=3;i<10;i++){
  92   7                                  LCD_write_char(i+2,0,JD[i]);
  93   7                              }
  94   6      
  95   6                              LCD_write_char(0,1,WD_a);            //显示纬度
  96   6                              LCD_write_char(1,1,' ');
  97   6                              for(i=0;i<2;i++){
  98   7                                  LCD_write_char(i+2,1,WD[i]);
  99   7                              }            
 100   6                              LCD_write_char(4,1,'.');
 101   6                              for(i=2;i<9;i++){
 102   7                                  LCD_write_char(i+3,1,WD[i]);
 103   7                              }                            }
 104   5                          LCD_write_char(14,0,use_sat[0]);        //显示接收卫星数
 105   5                          LCD_write_char(15,0,use_sat[1]);
 106   5                          buf_full&=~0x01;
 107   5                          dsp_count=0;
 108   5                      }
 109   4                      if(buf_full|0x02){                //GSV语句
 110   5                          LCD_write_char(14,1,total_sat[0]);
 111   5                          LCD_write_char(15,1,total_sat[1]);
 112   5                          buf_full&=~0x02;
 113   5                          dsp_count=0;
 114   5                      }
 115   4                      if(buf_full|0x04){
 116   5                          buf_full&=~0x04;
 117   5                          dsp_count=0;
C51 COMPILER V6.23a  1602GPS                                                               06/16/2008 13:14:49 PAGE 3   

 118   5                      }
 119   4                  }
 120   3                  else{                            //页面2
 121   4                      if(buf_full|0x01){                //GGA语句
 122   5                          buf_full&=~0x01;
 123   5                          dsp_count=0;
 124   5                      }
 125   4                      if(buf_full|0x02){
 126   5                          buf_full&=~0x02;
 127   5                          dsp_count=0;
 128   5                      }
 129   4                      if(buf_full|0x04){                //RMC语句
 130   5                          Bhour=((time[0]-0x30)*10+time[1]-0x30)+TIME_AREA;
 131   5                          if(Bhour>=24){
 132   6                              Bhour-=24;
 133   6                          }else if(Bhour<0){
 134   6                              Bhour+=24;
 135   6                          }
 136   5      
 137   5                                              for(i=0;i<4;i++){
 138   6                                  LCD_write_char(i+1,1,high[i]);
 139   6                              }
 140   5                          LCD_write_char(8,1,Bhour/10+0x30);
 141   5                          LCD_write_char(9,1,Bhour%10+0x30);
 142   5                          LCD_write_char(10,1,':');
 143   5                          LCD_write_char(11,1,time[2]);
 144   5                          LCD_write_char(12,1,time[3]);
 145   5                          LCD_write_char(13,1,':');
 146   5                          LCD_write_char(14,1,time[4]);
 147   5                          LCD_write_char(15,1,time[5]);
 148   5                                              LCD_write_char(0,1,'H');
 149   5                                              LCD_write_char(5,1,'M');
 150   5                                              LCD_write_char(7,1,'T');
 151   5                          if(spd_type){
 152   6                              LCD_write_string(5,0,"km/h A");
 153   6                          }else{
 154   6                              LCD_write_string(5,0,"knot A");
 155   6                          }
 156   5                          if(lock=='0'){                    //如果未定位
 157   6                              LCD_write_string(0,0,"---.-");
 158   6                              LCD_write_string(11,0,"---.-");
 159   6                          }else{                            //已经定位
 160   6                              if(spd_type){                    //km/h显示
 161   7                                  for(i=0;i<5;i++){
 162   8                                      LCD_write_char(i,0,speed[i]);
 163   8                                  }
 164   7                              }else{                            //knot显示
 165   7                                  Knots=    (((speed[0]-0x30)*1000
 166   7                                          +(speed[1]-0x30)*100
 167   7                                          +(speed[2]-0x30)*10
 168   7                                          +(speed[4]-0x30))*1000)/1852;
 169   7                                  LCD_write_char(0,0,Knots/1000+0x30);
 170   7                                  LCD_write_char(1,0,(Knots%1000)/100+0x30);
 171   7                                  LCD_write_char(2,0,(Knots%100)/10+0x30);
 172   7                                  LCD_write_char(3,0,'.');
 173   7                                  LCD_write_char(4,0,Knots%10+0x30);
 174   7                              }
 175   6                              for(i=0;i<5;i++){
 176   7                                  LCD_write_char(11+i,0,angle[i]);
 177   7                              }
 178   6                          }
 179   5                          buf_full&=~0x04;
C51 COMPILER V6.23a  1602GPS                                                               06/16/2008 13:14:49 PAGE 4   

 180   5                          dsp_count=0;
 181   5                      }
 182   4                  }
 183   3              }
 184   2          }
 185   1      }
 186          
 187          bit chk_key(void)
 188          {
 189   1          if(!KEY1){
 190   2              delayms(10);
 191   2              if(!KEY1){

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -