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

📄 ch451.lst

📁 这是ch451的驱动程序
💻 LST
字号:
C51 COMPILER V7.50   CH451                                                                 11/17/2008 11:46:29 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE CH451
OBJECT MODULE PLACED IN ch451.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ch451.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg51.h>
   2          #include <ch451.h>
   3          #include <SerialPort.h>
   4          #define uchar unsigned char
   5          #define uint unsigned int
   6          uchar ch451_key,flash,point; //全局变量,分别为:键值存放区,闪烁位,显示指针
   7          uint sit;
   8          bit   ch451_flag;                         
   9          uchar showram[]={30,30,30,30,30,30,30,30,30};//显存数组
  10          /*--------------------------显示数据----------------------*/
  11           void display(void)
  12           {      uint i,j;
  13   1              sit=0x000;                                                       //显示位指向第一位
  14   1              flash=1;                                                         //闪烁位指向第一位
  15   1              point=0;
  16   1         while(showram[point]!=30)
  17   1         { 
  18   2         ch451_write(CH451_DIG+sit+(showram[point]-0x30));
  19   2         sit=sit+0x100;                                               //显示位和闪烁位调整
  20   2         flash=flash*2;
  21   2         point++;                                                             //指针调整
  22   2         }
  23   1          ch451_write(CH451_TWINKLE+flash);    //设置闪烁控制
  24   1              ch451_write(CH451_DIG+22+sit);
  25   1         for(i=point+1,j=sit+0x100;i<=7;i++)
  26   1         {
  27   2         ch451_write(CH451_DIG+j+30);
  28   2         j=j+0x100;
  29   2         }
  30   1         }
  31          /*---------------------------对按键进行处理-----------------*/
  32          void ch451_process(void)                                //按键处理
  33          {
  34   1              ch451_keytest();                                         //转换键值
  35   1              ch451_flag=0;                                            //清标志
  36   1              if((ch451_key>47) && (ch451_key<58))
  37   1              {
  38   2                showram[point]=ch451_key;                      //向显存写入数据
  39   2               if(point>=8)                                            //判断显存是否已满
  40   2              {
  41   3                      showram[point]=30;                               //写入空格
  42   3                      point=0;                                                 //显存指针清零
  43   3              }                                                                
  44   2                display();                                             //刷新显示
  45   2                ch451_write(CH451_TWINKLE+flash);      //设置闪烁位
  46   2                ch451_write(CH451_DIG+22+sit);         //最右边数码管显示"-"并闪烁
  47   2              }
  48   1               if(ch451_key==8)                                        //判断是否为backspace
  49   1              {
  50   2                showram[point-1]=30;                           //删除位用空表示
  51   2                ch451_write(CH451_DIG+30+sit);
  52   2                display();                                             //刷新
  53   2              }
  54   1                 if(ch451_key==13)                             //判断是否为ENTER健
  55   1              {
C51 COMPILER V7.50   CH451                                                                 11/17/2008 11:46:29 PAGE 2   

  56   2                      send();
  57   2          }
  58   1              }
  59          /***********************************main********************************/
  60          void main(void)
  61          {  
  62   1              ch451_init();
  63   1              ch451_key=0;
  64   1              flash=1;
  65   1              sit=0x000;
  66   1              ch451_write(CH451_RESET);               //ch451复位
  67   1              ch451_write(CH451_SYSON2) ;             //开CH451显示,键盘  
  68   1          ch451_write(CH451_BCD);                     //以bcd码方式显示:数码管全亮
  69   1              ch451_check();
  70   1              ch451_write(CH451_DIG+22);                      //最右边数码管显示"-"并闪烁
  71   1              ch451_write(CH451_TWINKLE+flash);       //设置闪烁控制
  72   1              ch451_flag=0;
  73   1              seriaportset();
  74   1              while(1)
  75   1              {
  76   2               display();
  77   2                if(ch451_flag)
  78   2                {
  79   3                ch451_keytest();
  80   3                ch451_flag=0;
  81   3                ch451_process();
  82   3                 }
  83   2                      }
  84   1                      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    871    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     15    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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