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

📄 ts1620.lst

📁 这是我用AT89C51单片机做的定时控制器,最多可以输出八个不同时间段的脉冲.并且用TS1602 LCD显示出来.文件中包括源程序电路图和仿真电路图
💻 LST
字号:
C51 COMPILER V7.08   TS1620                                                                11/26/2008 16:48:12 PAGE 1   


C51 COMPILER V7.08, COMPILATION OF MODULE TS1620
OBJECT MODULE PLACED IN TS1620.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE TS1620.C BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*******************************************************************************
   2          *                                                                              *
   3          *    File       : wl009.c                                                      *
   4          *    Date       : 2004-1-5                                                     *
   5          *    Version    : 1.0                                                          *
   6          *                                                                              *
   7          *    Author     : Freeman          freeman@willar.com                          *
   8          *    Company    : Willar           www.willar.com                              *
   9          *                                                                              *
  10          ********************************************************************************
  11          *    Description:                                                              *
  12          *                字符LCD显示演示程序                                           *
  13          *                在第一行显示  welcome                                         *
  14          *                在第一行显示  www.willar.com                                  *
  15          *                                                                              *
  16          *******************************************************************************/
  17          #include <reg51.h>
  18          #include <intrins.h>
  19          #include "port.h"
  20          #include "TS1620.h"
  21          #include "delay.h"
  22          
  23          
  24          bit lcd_bz()
  25          {                                                       // 测试LCD忙碌状态
  26   1              bit result;
  27   1              rs = 0;
  28   1              rw = 1;
  29   1              ep = 1;
  30   1              _nop_();
  31   1              _nop_();
  32   1              _nop_();
  33   1              _nop_();
  34   1              result = (bit)(LCD_Port & 0x80);
  35   1              ep = 0;
  36   1              _nop_( );
  37   1          _nop_( );
  38   1              return result;  
  39   1      }
  40          
  41          lcd_wcmd(unsigned char cmd)
  42          {                                                       // 写入指令数据到LCD
  43   1              while(lcd_bz());
  44   1              rs = 0;
  45   1              rw = 0;
  46   1              ep = 0;
  47   1              _nop_();
  48   1              _nop_();        
  49   1              LCD_Port = cmd;
  50   1              _nop_();
  51   1              _nop_();
  52   1              _nop_();
  53   1              _nop_();
  54   1              ep = 1;
  55   1              _nop_();
C51 COMPILER V7.08   TS1620                                                                11/26/2008 16:48:12 PAGE 2   

  56   1              _nop_();
  57   1              _nop_();
  58   1              _nop_();
  59   1              ep = 0;         
  60   1          _nop_( );
  61   1          _nop_( );
  62   1      }
  63          
  64          
  65          lcd_wdat(unsigned char dat)     
  66          {                                                       //写入字符显示数据到LCD
  67   1              while(lcd_bz());
  68   1              rs = 1;
  69   1              rw = 0;
  70   1              ep = 0;
  71   1              LCD_Port = dat;
  72   1              _nop_();
  73   1              _nop_();
  74   1              _nop_();
  75   1              _nop_();
  76   1              ep = 1;
  77   1              _nop_();
  78   1              _nop_();
  79   1              _nop_();
  80   1              _nop_();
  81   1              ep = 0; 
  82   1              _nop_( );
  83   1              _nop_( );
  84   1      }
  85          
  86          
  87          void LocateXY(unsigned char x,unsigned char y)
  88          {       
  89   1              unsigned char temp;
  90   1              temp=x&0x0F;    
  91   1              y&=0x01;
  92   1              if(y) 
  93   1              {
  94   2               temp|=0x40;
  95   2              }
  96   1              temp|=0x80;                //Send Data to DDRAM D7 H                    
  97   1              lcd_wcmd(temp);
  98   1      }
  99          
 100          
 101          void DispOneChar(unsigned char x,unsigned char y,unsigned char dat)
 102          {
 103   1       LocateXY(x,y);
 104   1       lcd_wdat(dat); 
 105   1      }
 106          
 107          /*********显示字符串*********************/
 108          void PutStr(unsigned char x,unsigned char y, unsigned char *ptr)
 109          {
 110   1       unsigned char i,m=0;
 111   1       unsigned char k;
 112   1       while(ptr[m]>31)
 113   1       {
 114   2               m++;
 115   2       }
 116   1       for(i=0;i<m;i++)
 117   1       {
C51 COMPILER V7.08   TS1620                                                                11/26/2008 16:48:12 PAGE 3   

 118   2        k=ptr[i];
 119   2        DispOneChar(x++,y,k);
 120   2        if(x==16)
 121   2        {
 122   3         x=0;
 123   3         y^=1;
 124   3        }
 125   2       }
 126   1      }
 127          
 128          void chang_char_string(unsigned char c,unsigned char *s)
 129          {
 130   1       unsigned char m;
 131   1       unsigned char n;
 132   1       
 133   1       m=c&0xF0;
 134   1       m=m>>4;
 135   1       if((m>=0)&&(m<=9))
 136   1              {*s=m+0x30;}
 137   1       else
 138   1              {
 139   2               if((m>=0x0A)&&(m<=0x0F))
 140   2                 {*s=m+0x37;}
 141   2              }
 142   1       s++;
 143   1       
 144   1       n=c&0x0F;
 145   1       if((n>=0)&&(n<=9))
 146   1              {*s=n+0x30;}
 147   1       else
 148   1              {
 149   2               if((n>=0x0A)&&(n<=0x0F))
 150   2                 {*s=n+0x37;}
 151   2              }
 152   1      }
 153          
 154          
 155          void Send_charstr(unsigned char x,unsigned char y,unsigned char data1)
 156          {
 157   1       unsigned char m=0;
 158   1      
 159   1       unsigned char strT[2];
 160   1       unsigned char data2;
 161   1       data2=data1;
 162   1       chang_char_string(data2,strT);
 163   1       
 164   1        DispOneChar(x++,y,strT[0]);
 165   1        DispOneChar(x++,y,strT[1]);
 166   1      }
 167          
 168          void lcd_init(void)
 169          {                                                       //LCD初始化设定
 170   1              lcd_wcmd(0x38);                 //
 171   1              delay(10);
 172   1      
 173   1              lcd_wcmd(0x0c);                 //清除LCD的显示内容
 174   1              delay(5);
 175   1              lcd_wcmd(0x06);                 //清除LCD的显示内容
 176   1              delay(5);
 177   1              lcd_wcmd(0x01);                 //清除LCD的显示内容
 178   1              delay(5);
 179   1      }
C51 COMPILER V7.08   TS1620                                                                11/26/2008 16:48:12 PAGE 4   



MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    366    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      11
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       1
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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