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

📄 main.lst

📁 使用显示芯片ZLG7290
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V8.05a   MAIN                                                                 01/11/2008 12:42:17 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN Main.OBJ
COMPILER INVOKED BY: C:\Program Files\Keil C\C51\BIN\C51.EXE Main.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   2          //      项目名称:数字时钟
   3          //              作者:吕慧,陈莹莹
   4          //      修改日期:07-9-25
   5          //              版本:0.0
   6          //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
   7          
   8          #include "I2C.h"
   9          #include "ZLG7290.h"
  10          #define uchar unsigned char
  11          #define uint  unsigned int
  12          #define ulong unsigned long
  13          
  14          sbit    SPEAKER   = P1^2;
  15          //定义键盘中断标志,flagINT=1表示有键按下
  16          volatile bit flagINT = 0;
  17          uchar    cNum_key1 = 0;
  18          uchar    cNum_key2 = 0;
  19          uchar    uHour     = 0;    //小时
  20          uchar    uMonth    = 0;    //月份
  21          uchar    uDate     = 0;    //几号
  22          uchar    uSeconds  = 0;    //秒钟
  23          uchar    uMinitues = 0;    //分钟
  24          uchar    uHoures   = 0;    //时间中断的小时中间变量
  25          uchar    uSeconds_temp = 0;//闹钟定时30s
  26          volatile uint    iYear     = 0;    //年份
  27          volatile ulong   iAll_time = 0;    //总时间
  28          
  29          volatile bit alarm_flag   = 0;
  30          bit bChang_week   = 1;
  31          bit bChang_year   = 1;
  32          bit bChang_alarm  = 1;
  33          bit bChang_time   = 1;
  34          bit bRealkey2     = 0;
  35          bit bClear_stopwatch=1;
  36          code char DispDat[ ] =                   //共阴
  37          {       //(显示像素寻址指令)
  38                  0XFC,0X60,0XDA,0XF2,0X66,0xB6,0XBE,0XE0,0XFE,0XE6,    //0,1,2,3,4,5,6,7,8,9
  39                  0xEE,0x3E,0x9C,0x7A,0x9E,0x8E,0xF6,0x6E,0x20,             //字母AbCdEFgHiJkLoPqr -的字形数据  
  40                  0x70,0x0E,0x1C,0x3A,0xCE,0xE6,0x0A,0x02,0x01,0x00
  41          };
  42          uchar idata uTime_DisBuffer[8]     ={0,8,27,3,0,27,0,0};
  43          uchar idata uYear_DisBuffer[8]     ={0,7,28,0,9,28,2,6};
  44          uchar idata uWeek_DisBuffer[8]    ={28,28,28,28,4,28,28,28};
  45          uchar idata uStopwatch_DisBuffer[8]={0,0,27,0,0,27,0,0};
  46          uchar idata uAlarm_DisBuffer[8]   ={0,0,26,0,0,26,0,0};//  显示缓冲区地址
  47          
  48          ulong  iCounter_Inter3 = 0;   //进入中断3的次数
  49          ulong  iCounter_Inter3_temp = 0;//进入中断3的次数
  50          /*-------------------------------------------------------------
  51          函数:INT0_SVC()
  52          功能:ZLG7290键盘中断服务程序
  53          说明:中断触发方式选择负边沿触发,因此不必等待中断请求信号恢复为高电平
  54          -------------------------------------------------------------*/
  55          void INT0_SVC() interrupt 0 using 0
C51 COMPILER V8.05a   MAIN                                                                 01/11/2008 12:42:17 PAGE 2   

  56          {
  57   1              flagINT = 1;
  58   1      }
  59          
  60          /*-------------------------------------------------------------
  61          函数:Delay()
  62          功能:延时10ms~655.36s
  63          参数:
  64                  t>0时,延时(t*0.01)s
  65                  t=0时,延时655.36s
  66          说明:
  67                  晶振采用11.0592MHz
  68          -------------------------------------------------------------*/
  69          void Delay(unsigned int t)
  70          {
  71   1              uint i;
  72   1              for( i=0; i<t;i++);
  73   1      }
  74          
  75          /*-------------------------------------------------------------
  76          函数:SystemInit()
  77          功能:系统初始化
  78          -------------------------------------------------------------*/
  79          void SystemInit()
  80          {
  81   1              I2C_Init();
  82   1              TMOD = 0x11;
  83   1              Delay(30);              //等待ZLG7290复位完毕
  84   1      }
  85          
  86          /*-------------------------------------------------------------
  87          函数:ClearAll()
  88          功能:清除所有显示
  89          -------------------------------------------------------------*/
  90          void ClearAll()
  91          {
  92   1              uchar x;
  93   1              for ( x=0; x<8; x++ )
  94   1              {
  95   2                      ZLG7290_Download(x,0,0,31);
  96   2              }
  97   1      }
  98          
  99          /*-------------------------------------------------------------
 100          函数:DispBuf()
 101          功能:测试直接写显存
 102          调用:I2C_Puts(ZLG7290_I2C_ADDR,RegAddr,1,&dat,1)
 103          -------------------------------------------------------------*/
 104          void DispBuf(uchar *p)
 105          {
 106   1              uchar x;
 107   1              uchar reg;
 108   1              uchar dat;
 109   1      
 110   1              for ( x=0; x<8; x++ )
 111   1              {
 112   2                      reg = ZLG7290_DpRam + x;
 113   2                      dat = DispDat[p[x]];
 114   2                      ZLG7290_WriteReg(reg,dat);              ///
 115   2              }
 116   1      
 117   1      }
C51 COMPILER V8.05a   MAIN                                                                 01/11/2008 12:42:17 PAGE 3   

 118          
 119          /*-------------------------------------------------------------
 120          函数名称:Inter_detect_color( ) (定时器1中断)
 121          入口参数:None
 122          功能描述:每10MS进入一次中断
 123          -------------------------------------------------------------*/
 124          void Inter_detect_color( ) interrupt 3 using 3
 125          {       
 126   1          uchar temp;
 127   1              TH1 = 0XD8;         TL1 = 0XF0;         TR1 = 1; //每10MS进入一次定时器1中断
 128   1              iCounter_Inter3++;              //   对时间进行处理的标志量
 129   1              if (iCounter_Inter3==360000)
 130   1              {
 131   2                      iCounter_Inter3_temp = 0;
 132   2              }
 133   1              if (cNum_key1==4)  //进入秒表功能
 134   1              {
 135   2                      if (bRealkey2==1)
 136   2                      {
 137   3                              iCounter_Inter3_temp++;//     对秒表进行处理的标志量
 138   3      
 139   3                              if (bClear_stopwatch==1)
 140   3                              {
 141   4                                      iCounter_Inter3_temp=0;
 142   4                              }
 143   3                              temp = iCounter_Inter3_temp%100;
 144   3                              uStopwatch_DisBuffer[6]=temp/10;
 145   3                              uStopwatch_DisBuffer[7]=temp%10;
 146   3      
 147   3                              temp = iCounter_Inter3_temp/100%60;
 148   3                              uStopwatch_DisBuffer[3]=temp/10;

⌨️ 快捷键说明

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