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

📄 lcd_funct.lst

📁 DS8007 双智能卡读卡DEMO源代码。
💻 LST
字号:
C51 COMPILER V7.20   LCD_FUNCT                                                             03/19/2008 11:13:15 PAGE 1   


C51 COMPILER V7.20, COMPILATION OF MODULE LCD_FUNCT
OBJECT MODULE PLACED IN LCD_Funct.OBJ
COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.EXE LCD_Funct.c LARGE OMF2 OPTIMIZE(9,SIZE) BROWSE INCDIR(C:\Prog
                    -ram Files\Keil\C51\INC\Dallas) VARBANKING DEBUG

line level    source

   1          /*---------------------------------------------------------------------------
   2           *  Copyright (C) 2004 Dallas Semiconductor Corporation, All Rights Reserved.
   3           * 
   4           *  Permission is hereby granted, free of charge, to any person obtaining a
   5           *  copy of this software and associated documentation files (the "Software"),
   6           *  to deal in the Software without restriction, including without limitation
   7           *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
   8           *  and/or sell copies of the Software, and to permit persons to whom the
   9           *  Software is furnished to do so, subject to the following conditions:
  10           * 
  11           *  The above copyright notice and this permission notice shall be included
  12           *  in all copies or substantial portions of the Software.
  13           * 
  14           *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15           *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16           *  MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  17           *  IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
  18           *  OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19           *  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20           *  OTHER DEALINGS IN THE SOFTWARE.
  21           * 
  22           *  Except as contained in this notice, the name of Dallas Semiconductor
  23           *  shall not be used except as stated in the Dallas Semiconductor
  24           *  Branding Policy.
  25           * ---------------------------------------------------------------------------
  26           */
  27          
  28          #include "DS8007.h"
  29          #include "LCD_Funct.h"
  30          
  31          void LCD_Init()
  32          {
  33   1              LCD_Delay();                    // Delay to ensure LCD power-up complete
  34   1              
  35   1              LCD_WRCmd(FnctSet);             // Write FnctSet instruction
  36   1              LCD_WRCmd(DispCnt);     // Write Display Control instruction
  37   1              LCD_WRCmd(DispClear);   // Write Display Clear instruction
  38   1              LCD_WRCmd(EntryMode);   // Write Entry Mode instruction
  39   1      }
  40          
  41          // Write a string to the 2x20 LCD module
  42          void LCD_WRStr(uint8_t LCD_Str[])
  43          {
  44   1              int     i = 0;
  45   1      
  46   1              while ((LCD_Str[i] != '\0')     && (i < 20))
  47   1              {
  48   2                      LCD_WRChr(LCD_Str[i]) ;                                 // Write first 20 characters
  49   2                      i++;
  50   2              }
  51   1              
  52   1              if  (LCD_Str[i] != '\0')
  53   1                  LCD_WRCmd(Line2Ad);                                         // Set CGRAM address to first char 2nd line
  54   1      
C51 COMPILER V7.20   LCD_FUNCT                                                             03/19/2008 11:13:15 PAGE 2   

  55   1              while ((LCD_Str[i] != '\0')     && (i < 40))
  56   1              {
  57   2                      LCD_WRChr(LCD_Str[i]) ;
  58   2                      i++;
  59   2              }
  60   1      }
  61          
  62          // Write a single character to the 2x20 LCD module
  63          void LCD_WRChr(char LCD_Chr)
  64          {
  65   1              LCD_Busy();                             // Wait for not busy
  66   1              LCD_RS = 1;                             // Set RS high for character write
  67   1              LCD_Dat = LCD_Chr;              // Output character
  68   1              LCD_EN = 1;                             // Set enable high
  69   1              LCD_EN = 0;                             // Clear enable
  70   1              LCD_RS = 0;
  71   1              LCD_Dat = 0xFF;                 // Re-establish Port Pins as inputs
  72   1      }
  73          
  74          // Write a command to the 2x20 LCD module
  75          void LCD_WRCmd(uint8_t LCD_Cmd)
  76          {
  77   1              LCD_EN = 0;                             // Make sure the LCD enable is low 
  78   1              LCD_RS = 0;                             // Set LCD register select and R/W lines
  79   1              LCD_RW = 0;
  80   1              LCD_Busy();                             // Make sure display not busy
  81   1      
  82   1              LCD_Dat = LCD_Cmd;              // Output instruction
  83   1              LCD_EN = 1;                             // Set enable high
  84   1              LCD_EN = 0;                             // Clear enable
  85   1              LCD_Dat = 0xFF;                 // Re-establish Port Pins as inputs
  86   1      }
  87          
  88          // Set the cursor position to a specific location
  89          int LCD_Curpos(uint8_t VPos, uint8_t HPos)
  90          {
  91   1              int rtn;
  92   1              uint8_t Addr, Cmd;
  93   1      
  94   1              // Check input range 1..2 line, 1..20 characters per line
  95   1              if (((VPos == 0) || (VPos > 2)) || ((HPos == 0) || (HPos > 20)))
  96   1                      rtn = -1;
  97   1              else
  98   1              {
  99   2                      if(VPos == 2) Addr = (0x40 + (HPos - 1));
 100   2                      else Addr = HPos - 1;
 101   2                      rtn = 0;
 102   2                      Cmd = Addr | 0x80;
 103   2                      LCD_WRCmd(Cmd);
 104   2              }
 105   1              return(rtn);    
 106   1      }
 107          
 108          // Test the LCD Module to see if it is Busy (loop until
 109          // not busy) 
 110          void LCD_Busy()
 111          {
 112   1              uint8_t LCD_Stat = LCD_Dat;                     // Get byte containing status
 113   1      
 114   1              while (LCD_Stat & 0x80){                        // Wait for busy flag to clear
 115   2                      LCD_RW = 1;                                             // LCD RW needs to be high
 116   2                      LCD_EN = 1;                                             // Strobe enable signal
C51 COMPILER V7.20   LCD_FUNCT                                                             03/19/2008 11:13:15 PAGE 3   

 117   2                      LCD_Stat = LCD_Dat;                             // Read staus
 118   2                      LCD_EN = 0;
 119   2                      LCD_RW = 0;
 120   2              }
 121   1      }
 122          
 123          // Time delay for 2x20 LCD module (approximately 50 ms)
 124          void LCD_Delay()
 125          {
 126   1              uint8_t i, j ;
 127   1      
 128   1              for (i=0;i!=100;i++)
 129   1              {
 130   2                      for (j=0;j!=153;j++);
 131   2              }
 132   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    297    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----      10
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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