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

📄 ks0108.lst

📁 通过51解码38khz的红外遥控器信号
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.08   KS0108                                                                04/20/2007 20:29:50 PAGE 1   


C51 COMPILER V8.08, COMPILATION OF MODULE KS0108
OBJECT MODULE PLACED IN ks0108.OBJ
COMPILER INVOKED BY: D:\Keil_ARM\C51\BIN\C51.EXE ks0108.c COMPACT BROWSE DEBUG OBJECTEXTEND

line level    source

   1          //================================================================
   2          //                   KS0108驱动
   3          //================================================================
   4          #include <reg51.h>
   5          #include <FONT.h>
   6          //================================================================
   7          //  液晶接口定义
   8          //================================================================
   9          
  10          #define Lcd_Bus       P2                                             
  11          sbit       RS     =    P1^0;                                          
  12          sbit       RW     =    P1^1;                                           
  13          sbit       E      =    P1^2;                                          
  14          sbit       CSA   =     P1^3;                                          
  15          sbit       CSB   =     P1^4;                                          
  16          sbit       Lcd_Rst =      P1^5;         
  17          //================================================================
  18          //  KS0108指令代码定义
  19          //================================================================
  20          #define  Set_Disp_On 0x3F
  21          #define  Set_Disp_Off 0x3E
  22          #define  Set_Column  0x40
  23          #define  Set_Page  0xB8
  24          #define  Set_Start_Line 0xC0
  25          
  26          //---------------------------------------------------------------
  27          //基本硬件操作
  28          //----------------------------------------------------------------
  29          void Delay(int t);
  30          //void CheckState();unsigned char Read_0108_Data();
  31          void Write_0108_Reg(unsigned char Reg_Code);
  32          void Write_0108_Data(unsigned char Disp_Data);
  33          void Initialize();
  34          void SetPage(unsigned char Page);
  35          void SetColumn(unsigned char Column);
  36          static void PutData(unsigned char Page,unsigned char Column,unsigned char Page_amount,unsigned char Column
             -_amount);
  37          void ClearScr(unsigned char Page,unsigned char Column,unsigned char Page_amount,unsigned char Column_amoun
             -t);
  38          static void PutFont(unsigned char ascii_code,unsigned char mode,unsigned char i) ;
  39          void PutChar(unsigned char Page,unsigned char Column,unsigned char ascii_code,unsigned char mode) ;
  40          void DisplayListChar(unsigned char Page,unsigned char Column,unsigned char *listchar,unsigned char mode);
  41          static void PutPic(unsigned char width,unsigned char *pic,unsigned char mode,unsigned char i,unsigned char
             - j);
  42          void DisplayPic(unsigned char Page,unsigned char Column,unsigned char high,
  43                           unsigned char width,unsigned char *pic,unsigned char mode);
  44          
  45          
  46          //================================================================
  47          //         TEST
  48          //================================================================
  49          /*unsigned char code tip_pic[]={
  50          
  51           0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  52           0x00,0xF8,0xF8,0xC0,0x60,0x30,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
C51 COMPILER V8.08   KS0108                                                                04/20/2007 20:29:50 PAGE 2   

  53           0x00,0x00,0x00,0xF8,0xF8,0x98,0x98,0x98,0x00,0x00,0x00,0x00,0x00,
  54           0x00,0x00,0x00,0x00,0xF8,0xF8,0x18,0x18,0xF8,0xF8,0x00,0x00,0x00,
  55           0x00,0x00,0x00,0x00,0x00,0x08,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,
  56           0x00,0x00,0x00,0xF8,0xF8,0x18,0x18,0xF8,0xF8,0x00,0x00,0x00,0x00,
  57           0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,0x18,0x18,0xF8,0xF8,0x00,0x00,
  58           0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  59           0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
  60           0xC0,0xC0,0xC0,0xE0,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
  61           0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,
  62           0x3F,0x06,0x0C,0x18,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  63           0x00,0x31,0x31,0x31,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  64           0x00,0x00,0x3F,0x3F,0x30,0x30,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,
  65           0x00,0x00,0x00,0x20,0x3F,0x3F,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
  66           0x00,0x3F,0x3F,0x30,0x30,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,
  67           0x00,0x00,0x00,0x3F,0x3F,0x31,0x31,0x3F,0x3F,0x00,0x00,0x00,0x00,
  68           0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x00,
  69           0x00,0x03,0x03,0x07,0x7F,0x7F,0x0F,0x1F,0x07,0x03,0x03,0x03,0x03,
  70           0x03,0x03,0x01,0x01,0x01,0x00,0x00,0x00,0x00,
  71          }; 
  72          unsigned char code TEST[]="KS0108 CONTROLER TEST";
  73          main()
  74          {
  75          Initialize();
  76          ClearScr(0,0,8,128);
  77          DisplayPic(0,0,2,128,tip_pic,1);
  78          DisplayListChar(4,0,TEST,1);
  79          //PutChar(1,62,'T',1);
  80          while(1) ;
  81          }*/
  82          //================================================================
  83          //  延时子程序
  84          //================================================================
  85          void Delay(int t)
  86          {
  87   1       while(--t);
  88   1      }
  89          /*================================================================
  90          //状态检查
  91          //================================================================
  92          void CheckState()
  93          {
  94          unsigned char dat;
  95          RS=0;
  96          RW=1;
  97          do{
  98          Lcd_Bus=0xff;
  99          E=1; dat=Lcd_Bus; E=0;
 100          dat=0x90 & dat; //仅当第4,7位为0时才可操作
 101          }while(!(dat==0x00));
 102          }*/
 103          //================================================================
 104          //  KS0108寄存器写入函数
 105          //================================================================
 106          void Write_0108_Reg(unsigned char Reg_Code)
 107          {
 108   1       //CheckState(); //如果不是频繁操作不需检查
 109   1       RS=0;
 110   1       RW=0;
 111   1       Lcd_Bus=Reg_Code;
 112   1       E=1;
 113   1       E=0;
 114   1      }
C51 COMPILER V8.08   KS0108                                                                04/20/2007 20:29:50 PAGE 3   

 115          //================================================================
 116          //  KS0108显示数据写入函数
 117          //================================================================
 118          void Write_0108_Data(unsigned char Disp_Data)
 119          {
 120   1       //CheckState();
 121   1       RS=1;
 122   1       RW=0;
 123   1       Lcd_Bus=Disp_Data;
 124   1       E=1;
 125   1       E=0;
 126   1      }
 127          //================================================================
 128          //  读取KS0108显示数据函数
 129          //================================================================
 130          /*unsigned char Read_0108_Data()
 131          {
 132          unsigned char Disp_Data;
 133          
 134           RS=1;
 135           RW=1;
 136           Lcd_Bus=0xff;
 137           E=1;
 138           Disp_Data=Lcd_Bus;
 139           E=0;
 140           return Disp_Data;
 141          }*/
 142          //================================================================
 143          //  KS0108寄存器初始化函数
 144          //================================================================
 145          void Initialize()
 146          { 
 147   1      Lcd_Rst=0;
 148   1      Delay(100);
 149   1      Lcd_Rst=1;
 150   1      Delay(100);
 151   1      CSA=1;
 152   1      CSB=1;
 153   1      Delay(100);

⌨️ 快捷键说明

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