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

📄 ledlib.lst

📁 一个数字温度计源代码 MCU是AT89S52 温度传感器是DS18B20 温度测量范围-30 - 100 精度0.5度
💻 LST
字号:
C51 COMPILER V8.08   LEDLIB                                                                12/13/2007 14:04:03 PAGE 1   


C51 COMPILER V8.08, COMPILATION OF MODULE LEDLIB
OBJECT MODULE PLACED IN LedLib.OBJ
COMPILER INVOKED BY: C:\Keil_c51\C51\BIN\C51.EXE LedLib.c BROWSE

line level    source

   1          #include "Ledlib.h"
   2          
   3          
   4          
   5          //=================[ledShowDigit]==============
   6          //Description:this mathod is used to set a digit to a specified bit on the led
   7          //Author:Decelll.Zhou
   8          //Version
   9          //arg:  digit |  unsigned char |  the digit you want to show | 0-9
  10          //              position | unsigned char | the position of the digit | 0-3
  11          //              dp  |  unsigned  char |  if you want to show the dp, set this argument to 1
  12          //return;       0 | method terminated normally
  13          //                      1 | method meet critical error
  14          //=============================================
  15          int ledSetDigit(unsigned char digit,unsigned char position, unsigned char dp){
  16   1              
  17   1              //the Led Code table for the digit
  18   1              //0:0011 1111;0x3f
  19   1              //1:0000 0110;0x06
  20   1              //2;0101 1011:0x5b
  21   1              //3:0100 1111:0x4f
  22   1              //4;0110 0110;0x66
  23   1              //5:0110 1101:0x6d
  24   1              //6;0111 1101:0x7d
  25   1              //7:0000 0111:0x07
  26   1              //8:0111 1111:0x7f
  27   1              //9:0110 0111:0x67
  28   1              //10:0100 0000:0x40:the minius sign for a value
  29   1              unsigned char digCode[11] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67,0x40};
  30   1      
  31   1              //check the digit to see if it is valid
  32   1              if(digit > 9 || digit < 0){
  33   2                      return 1;
  34   2              }
  35   1      
  36   1              //set the pin Lev. of P0 accroding to the value of digit
  37   1              P0 = digCode[digit];
  38   1      
  39   1              //set the dp as the argument told us
  40   1              if(dp == 1){
  41   2              P0 |= 0x80;
  42   2              }
  43   1      
  44   1              //check the value of the position to see whether it is valid
  45   1              if(position > 3){// we only have 4 bits Led, that is bit0-bit3
  46   2                      return 1;
  47   2              }
  48   1              //set the bit of P2 to low Lev. accroding to the value of position
  49   1              P2 &= ~(0xf);//clear bit0-bit3
  50   1              P2 |= ~((0x1 << position) & 0xf);
  51   1              
  52   1              return 0;
  53   1              
  54   1      
  55   1      }
C51 COMPILER V8.08   LEDLIB                                                                12/13/2007 14:04:03 PAGE 2   



MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     94    ----
   CONSTANT SIZE    =     11    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      14
   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 + -