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

📄 lcd.lst

📁 主要介绍了24c16的读写,mcu为89s52,lcd为TC2002A,完成功能是把数据写入24c16中,再把数据从24c16读出,并显示在lcd中.编辑环境为keil2,已通过测试.
💻 LST
字号:
C51 COMPILER V6.12  LCD                                                                    07/07/2007 13:55:08 PAGE 1   


C51 COMPILER V6.12, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN .\Lcd.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\Lcd.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          
   2          #include<reg52.h>
   3          #include"port.h"
   4          #include"main.h"
   5          #include"lcd.h"
   6          #include"delay.h"
   7          #include<intrins.h>
   8          
   9          void SHIFT(uChar dispdata)
  10          {         
  11   1      	uChar i,j;
  12   1      	DISSP = 0;                    //define variable
  13   1      	j = dispdata;
  14   1      	for(i=0; i<8; i++)               //write 8 bit
  15   1      	{
  16   2      		if((j & 0x80) == 0)
  17   2      		{
  18   3      			SOUT = 0;        
  19   3      		}		                //get the highest bit   
  20   2      		else
  21   2      		{		
  22   3      			SOUT = 1;	
  23   3      		}
  24   2      		SCK = 0;
  25   2      		SCK = 1;
  26   2      		SCK = 0;
  27   2      		j <<= 1;                   //move left wrTemp one bit 
  28   2      	}
  29   1      	DISSP = 1;
  30   1      }
  31          
  32          void LCD_WCOM(uChar dispdata)   
  33          {   
  34   1      //	LcdOut = dispdata;
  35   1      	SHIFT(dispdata);
  36   1      	LCD_RS = 0 ;
  37   1      	LCD_E = 1;    
  38   1      	LCD_E = 0;
  39   1      	DELAY(40);
  40   1      }
  41          
  42          void LCD_WDATA(uChar dispdata)
  43          {   
  44   1      //	LcdOut = dispdata;
  45   1      	SHIFT(dispdata);
  46   1      	LCD_RS = 1;
  47   1      	LCD_E = 1;    
  48   1      	LCD_E = 0; 
  49   1      	DELAY(1);
  50   1      }
  51          
  52          void LCD_INIT(void)
  53          {
  54   1          DELAY(40);
  55   1      //	LcdWr = 0;	
C51 COMPILER V6.12  LCD                                                                    07/07/2007 13:55:08 PAGE 2   

  56   1      	LCD_WCOM(0x38); //0x01
  57   1      	LCD_WCOM(0x38);//0x30 8位 
  58   1      	LCD_WCOM(0x38); 
  59   1      	LCD_WCOM(0x38);
  60   1      	LCD_WCOM(0x06);//0x0c
  61   1      	LCD_WCOM(0x0c);
  62   1      	LCD_WCOM(0x01);
  63   1      }
  64          uChar LCD_DISP(uChar *ptr_Char, uChar postion, uChar num) //num From 0 ~1 post from 0~7
  65          {
  66   1      	uChar i;
  67   1      	if ((postion >= 101) && ( postion <= 120))         //第一行  自定义101~120    100 < post < 121 
  68   1      	{	
  69   2      		LCD_WCOM(0x80 + postion -101); 
  70   2      	}
  71   1      	else if((postion >= 201) && (postion <= 220))	   //第二行 自定义201~220         200 < post < 221
  72   1      		{
  73   2      			LCD_WCOM(0xc0 + postion -201) ;
  74   2      		}
  75   1      		else if(postion != 0)
  76   1      		{
  77   2      			return ERROR;                                  //不在范围

⌨️ 快捷键说明

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