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

📄 main.lst

📁 单片机键盘以及LCD和AD控制程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V8.02   MAIN                                                                  09/06/2007 21:39:22 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /******************************************************
   2          
   3          键盘占用CS1 地址  0x9000        占用中断0
   4          显示占用CS2 地址  0xa000
   5          地址CS0
   6                          0x8000~0x8100  WR
   7                          0x8200~0x8300  WR
   8                          0x8400~0x8500  WR
   9                          0x8600~0x8700  WR
  10                          0x8800~0x8900  RD
  11                          0x8a00~0x8b00  RD
  12                          0x8c00~0x8d00  RD
  13                          0x8e00~0x8f00  RD
  14          FCLK/FC=56K
  15          注意:ADC0-ADC3不可以用 没有接通
  16                  ADC6-ADC7不要用 因为没有接运放
  17          DDS9851占用了 0x8000//数据      0x8200/控制
  18          增益控制 0x8400
  19          MAX262  8600 
  20          可以使用的I/O : T0/P3^4 INT1/P3^3
  21          串口亦可以尝试作为I/O  RXD/P3^0 TXD/P3^1
  22          ******************************************************/
  23          #include "lcd.h"
  24          #include "dds9851b.h"
  25          #include "max262.h"
  26          #include "dds.h"
  27          #define ATMEL XBYTE[0x9000]
  28          #define AMP XBYTE[0x8400]
  29          unsigned char KeyValue;    //键值
  30          
  31          
  32          unsigned char xdata Confirm=0;//确认键按下的次数
  33          
  34          unsigned char xdata Menu=0;//表示当前选定的菜单项
  35          unsigned char xdata SubMenu=0;//表示第一级子菜单
  36                                  bit MenuSelect=0;
  37                                  bit SubMenuSelect=0;
  38          
  39          unsigned char xdata SubConfirm=0;//用于标志子菜单的确认键
  40                                  bit Add=0;//用于第三次按下确认键的处理
  41          /*************************************************************
  42          以上是与键盘有关的变量
  43          **********************************************************/
  44          unsigned long xdata ChFr=100;   //扫频信号的频率
  45          unsigned int xdata Adcout[10]={0};      //AD保存的结果
  46          unsigned char xdata Adctimes=0;
  47          
  48          unsigned char xdata HighPass=0; //高通截止频率
  49          unsigned char xdata LowPass=0; //低通截止频率
  50          
  51          
  52          sbit FILTERSEL=P3^3;//int1 切换滤波器
  53          sbit DbSel=P3^0;//RXD
  54          
  55          double xdata Result[21]=0;
C51 COMPILER V8.02   MAIN                                                                  09/06/2007 21:39:22 PAGE 2   

  56          unsigned char xdata RSN=0;
  57          
  58          void RootMenu()
  59          {
  60   1              Lcd_clear();
  61   1              Disp_char(0,'1');
  62   1              Disp_words(1,"菜单一",3);
  63   1              Disp_char(16,'2');
  64   1              Disp_words(9,"菜单二",3);
  65   1              Disp_char(32,'3');
  66   1              Disp_words(17,"菜单三",3);
  67   1              Disp_char(48,'4');
  68   1              Disp_words(25,"菜单四",3);
  69   1              Cursor_Reset();
  70   1              Delay(1000);
  71   1      }
  72          
  73                          void SubMenu1()
  74                          {
  75   1                              Lcd_clear();
  76   1                              Disp_char(0,'1');
  77   1                              Disp_words(1,"放大器设置",5);
  78   1                              Disp_char(16,'2');
  79   1                              Disp_words(9,"低通滤波器",5);
  80   1                              Disp_char(32,'3');
  81   1                              Disp_words(17,"高通滤波器",5);
  82   1                              Disp_char(48,'4');
  83   1                              Disp_words(25,"幅频测试",4);
  84   1                              Cursor_Reset();
  85   1                              Delay(2000);
  86   1                      }
  87                                        void Sub11Disp()
  88                                            {
  89   1                                        Lcd_clear();
  90   1                                        Disp_words(1,"增益设置",4);
  91   1                                        Delay(2000);
  92   1                                        }
  93                                            void Sub11Op()        //      执行操作时应给出相应的提示信息
  94                                            {
  95   1      
  96   1                                        }
  97                                            void Sub12Disp()
  98                                            {
  99   1                                        FILTERSEL=0;//低通滤波器
 100   1                                        Lcd_clear();
 101   1                                        Disp_words(1,"截止频率步进",6);
 102   1                                        Delay(2000);
 103   1                                        }
 104                                            void Sub12Op()
 105                                            {
 106   1                                        Lcd_clear();
 107   1                                        Disp_words(1,"截止频率为",5);                 
 108   1                                        Delay(2000);
 109   1                                        DbSel=0;
 110   1                                        LowPass++;
 111   1                                        if((LowPass<20)||(LowPass==20))
 112   1                                        {
 113   2                                              if((LowPass==17)||(LowPass==18)||(LowPass==19)||(LowPass==20))
 114   2                                              DbSel=1;
 115   2                                        DDS9851_ComputeFreqWord(LowPass*100000,DDS9851FreTab);
 116   2                                        DDS9851_WriteFreqWord(DDS9851FreTab);
 117   2                                        Delay(2000);
C51 COMPILER V8.02   MAIN                                                                  09/06/2007 21:39:22 PAGE 3   

 118   2                                        }
 119   1                                        else 
 120   1                                            {LowPass=0;DbSel=0;}
 121   1                                        Disp_number(16,LowPass);
 122   1                                        Disp_chars(19,"KHz",3);
 123   1                                        }
 124                                            void Sub13Disp()
 125                                            {
 126   1                                        FILTERSEL=1;//高通滤波器
 127   1                                        Lcd_clear();
 128   1                                        Disp_words(1,"截至频率步进",6);
 129   1                                        Delay(2000);
 130   1                                        Hips();
 131   1                                        }
 132                                            void Sub13Op()
 133                                            {     
 134   1                                        Lcd_clear();
 135   1                                        Disp_words(1,"截止频率为",5);
 136   1                                        Delay(2000);
 137   1                                        HighPass++;
 138   1                                        if((HighPass<20)||(HighPass==20))
 139   1                                        {
 140   2                                        DDS9851_ComputeFreqWord(HighPass*56000,DDS9851FreTab);
 141   2                                        DDS9851_WriteFreqWord(DDS9851FreTab);
 142   2                                        Delay(2000);
 143   2                                        }
 144   1                                        else HighPass=0;
 145   1                                        Disp_number(16,HighPass);
 146   1                                        Disp_chars(19,"KHz",3);
 147   1                                        }
 148                                            void Sub14Disp()
 149                                            {
 150   1                                        Lcd_clear();
 151   1                                        Disp_words(1,"扫频准备",4);
 152   1                                        Delay(2000);
 153   1                                        }
 154                                            void Sub14Op()
 155                                            {
 156   1                                              Lcd_clear();
 157   1                                              Disp_words(1,"扫频开始",4);     
 158   1                                              Delay(2000);
 159   1                                              AMP=~2;
 160   1                                              ChFr=100;
 161   1                                              RSN=0;
 162   1                                              ADCCON1= 0x9c;
 163   1                                              ADCCON2= 0x04;//选择通道4
 164   1                                              EADC = 1;
 165   1                                              CCONV = 1;
 166   1                                        }
 167                          
 168                          
 169                          void SubMenu2()
 170                          {
 171   1                              Lcd_clear();
 172   1                              Disp_char(0,'1');
 173   1                              Disp_words(1,"子菜单二一",5);
 174   1                              Disp_char(16,'2');
 175   1                              Disp_words(9,"子菜单二二",5);
 176   1                              Disp_char(32,'3');
 177   1                              Disp_words(17,"子菜单二三",5);
 178   1                              Disp_char(48,'4');
 179   1                              Disp_words(25,"子菜单二四",5);
C51 COMPILER V8.02   MAIN                                                                  09/06/2007 21:39:22 PAGE 4   

 180   1                              Cursor_Reset();
 181   1                              Delay(2000);
 182   1                      }
 183                                        void Sub21Disp()
 184                                            {
 185   1                                        Lcd_clear();
 186   1                                        Disp_words(1,"请输入频率",5);
 187   1                                        Delay(2000);
 188   1                                        }
 189                                            void Sub21Op()
 190                                            {
 191   1                                        }
 192                                            void Sub22Disp()
 193                                            {
 194   1                                        Lcd_clear();

⌨️ 快捷键说明

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