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

📄 ps7219.lst

📁 Keil下的ps7219完整编程
💻 LST
字号:
C51 COMPILER V7.50   PS7219                                                                11/03/2006 15:08:02 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE PS7219
OBJECT MODULE PLACED IN PS7219.OBJ
COMPILER INVOKED BY: D:\Program Files\C51\BIN\C51.EXE PS7219.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*******************************************************************************************/
   2          //     the copyright is hold by yanxu  
   3          //         the company of hunan huasheng 
   4          //         2006.9.22
   5          //         its purpose is drivering the ps7219 which is the led driver 
   6          /*******************************************************************************************/
   7          
   8          #define __SRC
   9            #include "PS7219.h"
*** ERROR C100 IN LINE 87 OF PS7219.H: unprintable character 0xA3 skipped
*** ERROR C100 IN LINE 87 OF PS7219.H: unprintable character 0xBB skipped
*** ERROR C100 IN LINE 89 OF PS7219.H: unprintable character 0xA3 skipped
*** ERROR C100 IN LINE 89 OF PS7219.H: unprintable character 0xBB skipped
*** ERROR C132 IN LINE 91 OF PS7219.H: '_test_control_n': not in formal parameter list
*** ERROR C141 IN LINE 91 OF PS7219.H: syntax error near 'void'
  10          #undef __SRC
  11          
  12          #include <reg52.h>
  13          
  14          /*******************************************************************************************/
  15          //function InitIO_PS7219(); initialize the PS7219
  16          /*******************************************************************************************/
  17          void InitIO_PS7219()
*** ERROR C132 IN LINE 17 OF PS7219.C: '_decode_led_n': not in formal parameter list
*** ERROR C141 IN LINE 17 OF PS7219.C: syntax error near 'void'
  18          {
*** ERROR C132 IN LINE 18 OF PS7219.C: 'InitIO_PS7219': not in formal parameter list
*** ERROR C141 IN LINE 18 OF PS7219.C: syntax error near '{'
  19                  LOAD=0;                 //clear the load signal 
*** ERROR C136 IN LINE 19 OF PS7219.C: 'LOAD': 'void' on variable
*** ERROR C244 IN LINE 19 OF PS7219.C: 'LOAD': can't initialize, bad type or class
*** ERROR C136 IN LINE 19 OF PS7219.C: 'LOAD': 'void' on variable
*** ERROR C132 IN LINE 19 OF PS7219.C: 'LOAD': not in formal parameter list
  20                  CLK=1;                  //set the clk signal high
*** ERROR C244 IN LINE 20 OF PS7219.C: 'CLK': can't initialize, bad type or class
*** ERROR C132 IN LINE 20 OF PS7219.C: 'CLK': not in formal parameter list
  21          }
*** ERROR C141 IN LINE 21 OF PS7219.C: syntax error near '}'
  22          
  23          /*******************************************************************************************/
  24          //function Delay5us();Delay 5us
  25          /*******************************************************************************************/
  26          void Delay5us(unsigned char  n)
  27          {
  28   1              unsigned int i;
  29   1              while(n--)
  30   1              for(i=0;i<4;i++);      
  31   1      }
  32          
  33          /*******************************************************************************************/
  34          //function SpiWrite();
  35          /*******************************************************************************************/
  36          void SpiWrite(unsigned char byte)
  37          {
  38   1              unsigned char i;
C51 COMPILER V7.50   PS7219                                                                11/03/2006 15:08:02 PAGE 2   

  39   1       
  40   1              DATA_BUF=byte;                          // Put function's parameter into a bdata variable               
  41   1              for (i=0;i<8;i++)                       // Setup byte circulation bits
  42   1              {             
  43   2              if (flag)                           // Put DATA_BUF.7 on data line
  44   2                      DO=1;
  45   2              else
  46   2                      DO=0;
  47   2                      Delay5us(1);                                                    // delay 5us
  48   2              CLK=0;                              // Set clock line low
  49   2                      Delay5us(1);
  50   2              DATA_BUF=DATA_BUF<<1;                           // Shift DATA_BUF
  51   2              CLK=1;                              // Set clock line high 
  52   2              }       
  53   1      }
  54          
  55          /*******************************************************************************************/
  56          //function send_ps7219();send 1 byte address and 1 byte data to PS7219
  57          /*******************************************************************************************/
  58          void send_ps7219(unsigned char addr,unsigned char mdata)
  59          {
  60   1              unsigned char j;
  61   1      
  62   1              SpiWrite(addr);
  63   1              
  64   1          DATA_BUF=mdata;                         // Put function's parameter into a bdata variable             
             -  
  65   1              for (j=0;j<7;j++)                       // Setup byte circulation bits
  66   1              {          
  67   2              if (flag)                           // Put DATA_BUF.7 on data line
  68   2                      DO=1;
  69   2              else
  70   2                      DO=0;
  71   2                      Delay5us(1);
  72   2              CLK=0;                              // Set clock line low
  73   2                      Delay5us(1);
  74   2              DATA_BUF=DATA_BUF<<1;                           // Shift DATA_BUF
  75   2              LOAD=1;                                                         // after the 15th clock's falling edge, set the load signal high
  76   2                      CLK=1;                              // Set clock line high 
  77   2              } 
  78   1          
  79   1              if (flag)                               // Put the 16th bit on data line
  80   1              DO=1;
  81   1          else
  82   1              DO=0;
  83   1              Delay5us(1);
  84   1              CLK=0;                                                                  // Set clock line high 
  85   1              Delay5us(1);
  86   1              CLK=1;
  87   1              Delay5us(8);                                                    // delay 40us because the load line need to be setted high for 50us
  88   1              LOAD=0;                                                                 // clear the load line
  89   1      }
  90          
  91          /*******************************************************************************************/
  92          //function send_ps7219_n();send 1 byte address and 1 byte data to Nth PS7219
  93          //addr: 0x01 - digital_1 ; 0x02 - digital_2;....so 0x08 - digital8;
  94          //madt: 0x00 - num_0; 0x01 - num_1;....0x09 - num_9;
  95          /*******************************************************************************************/
  96          void send_ps7219_n(unsigned char add,unsigned char mdat,unsigned char n)
  97          {
  98   1              unsigned char i;
  99   1      
C51 COMPILER V7.50   PS7219                                                                11/03/2006 15:08:02 PAGE 3   

 100   1              if(n==1)
 101   1              {
 102   2                      send_ps7219(add,mdat);                  //send the address and the data]
 103   2              }
 104   1              else
 105   1              {
 106   2                      send_ps7219(add,mdat);
 107   2                      for(i=0;i<n-1;i++)
 108   2                      {
 109   3                              send_ps7219(0xf0,0xff);         //send no-op code to the (n-1)th PS7219 in the head 
 110   3                      }
 111   2              }
 112   1      
 113   1      }
 114          
 115          /*******************************************************************************************/
 116          //function glitter_led_n();glitter the led which is controled by the n PS7219
 117          //n:    第N个PS7219
 118          //ledn: 第N个PS7219控制礜LED
 119          //ledn: xxxx xxxx 8个LED对应位为1时闪烁
 120          /*******************************************************************************************/
 121          void glitter_led_n(unsigned char ledn,unsigned char n)
 122          {
 123   1              send_ps7219_n(0x0D,ledn,n);
 124   1      }
 125          /*******************************************************************************************/
 126          //function decode_led_n();glitter the led which is controled by the n PS7219
 127          //n:    第N个PS7219
 128          //ledn: 第N个PS7219控制礜LED
 129          //ledn: xxxx xxxx 8个LED在其对应位为1时进行BCD译码
 130          /*******************************************************************************************/
 131          void decode_led_n(unsigned char ledn,unsigned char n)
 132          {
 133   1              send_ps7219_n(0x09,ledn,n);
 134   1      }
 135          
 136          /*******************************************************************************************/
 137          //function display_led_n();display the led which is controled by the n PS7219
 138          //n:    第N个PS7219
 139          //ledn: 第N个PS7219控制的显示的L
 140          //ledn: 0x00 显示第一个LED and 0x01显示第一和第二个LEDs...so 0x显示全部8个leds(most)
 141          /*******************************************************************************************/
 142          void display_led_n(unsigned char ledn,unsigned char n)
 143          {
 144   1              send_ps7219_n(0x0B,ledn,n);
 145   1      }
 146          
 147          /*******************************************************************************************/
 148          //function bright_led_n();control the brightness of the led
 149          //n:    第N个PS7219
 150          //ledn: 第N个PS72控制的LED的亮

⌨️ 快捷键说明

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