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

📄 max7221.lst

📁 MAX7219MAX7221点亮数码管程序
💻 LST
字号:
C51 COMPILER V7.06   MAX7221                                                               12/11/2008 20:18:05 PAGE 1   


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

stmt level    source

   1          #include <REG52.H>
   2          #include <Max7221.h>
   3          
   4          unsigned char DisplayBuffer[8]={9,1,5,3,0,4,6,7};//显示缓冲区
   5          
   6          
   7          unsigned char code table2[]=
   8          {0xfc, 0x60, 0xda, 0xf2, 0x66, 0xb6, 0xbe, 0xe0, 0xfe, 0xe6, 0x02};
   9          unsigned char code table3[]=
  10          {~0xfc, ~0x60, ~0xda, ~0xf2, ~0x66, ~0xb6, ~0xbe, ~0xe0, ~0xfe, ~0xe6, ~0x02};
  11          
  12          
  13          unsigned char code tablea[]=
  14          {0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01};//段选编码
  15          unsigned char code tableb[]=
  16          {0x02, 0x02,0x02,0x02,0x02,0x02,0x02,0x02};//段选编码
  17          unsigned char code tablec[]=
  18          {0x04, 0x04,0x04,0x04,0x04,0x04,0x04,0x04};//段选编码
  19          unsigned char code tabled[]=
  20          {0x08, 0x08,0x08,0x08,0x08,0x08,0x08,0x08};//段选编码
  21          unsigned char code tablee[]=
  22          {0x10, 0x10,0x10,0x10,0x10,0x10,0x10,0x10};//段选编码
  23          unsigned char code tablef[]=
  24          {0x20, 0x20,0x20,0x20,0x20,0x20,0x20,0x20};//段选编码
  25          unsigned char code tableg[]=
  26          {0x40, 0x40,0x40,0x40,0x40,0x40,0x40,0x40};//段选编码
  27          unsigned char code tableh[]=
  28          {0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80};//段选编码
  29          void delay(void)
  30          {   unsigned int a,b;
  31   1          a=5000;b=10;
  32   1              while(b--)
  33   1              while(a--);
  34   1      
  35   1      }
  36          
  37          unsigned char change(unsigned char *tab)
  38          {
  39   1          unsigned char tabl[8];
  40   1          
  41   1          unsigned char i;
  42   1              for(i=0;i<8;i--)
  43   1              {
  44   2              tabl[i] =(tab[i]>>7)&0x01 * (1<<7)
  45   2                  +(tab[i]>>6)&0x01 * (1<<6)
  46   2                              +(tab[i]>>5)&0x01 * (1<<5)
  47   2                              +(tab[i]>>4)&0x01 * (1<<4)
  48   2                              +(tab[i]>>3)&0x01 * (1<<3)
  49   2                              +(tab[i]>>2)&0x01 * (1<<2)
  50   2                              +(tab[i]>>1)&0x01 * (1<<1)
  51   2                              +(tab[i]>>0)&0x01 * 1;
  52   2      
  53   2              }
  54   1              for(i=0;i<8;i++) tabl[i]&=0xff;
  55   1              return *tabl;
C51 COMPILER V7.06   MAX7221                                                               12/11/2008 20:18:05 PAGE 2   

  56   1      }
  57          unsigned char code table[]=
  58          {0x3f,0x06,0x5b,0x4f
  59          ,0x66,0x6d,0x7d,0x07,
  60          0x7f,0x6f};//段选编码
  61          
  62          unsigned char code table4[]=//这个译码数组0、123467已经改好了! by张强
  63          {0x7e, 0x12,  0x4f,0x5b
  64          ,0x33, 0x6d, 0x7d, 0x52,
  65           0x7f,0x6f};//段选编码
  66          
  67          main()
  68          {   unsigned char tablo[8];
  69   1              InitialMax7221();
  70   1      
  71   1              *tablo=change(&table);
  72   1              
  73   1              //while(1)
  74   1              { 
  75   2                Max7221Display(&tablo[0]);
  76   2                //delay();
  77   2                // Max7221Display2(&tablea[0]);
  78   2      
  79   2                //delay();
  80   2              // Max7221Display2(&tableb[0]);
  81   2      
  82   2                //delay();
  83   2                //Max7221Display2(&tablec[0]);
  84   2      
  85   2                //delay();
  86   2               // Max7221Display2(&tabled[0]);
  87   2      
  88   2                //delay();
  89   2                // Max7221Display2(&tablee[0]);
  90   2      
  91   2               // delay();
  92   2               //Max7221Display2(&tablef[0]);
  93   2      
  94   2               // delay();
  95   2                //Max7221Display2(&tableg[0]);
  96   2      
  97   2                
  98   2               // Max7221Display2(&tableh[0]);
  99   2                //delay();
 100   2              }
 101   1              while(1);
 102   1      
 103   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    397    ----
   CONSTANT SIZE    =    106    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      8      27
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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