|
|
|
|
C51 COMPILER V9.56.0.0 LCD 04/06/2022 22:23:01 PAGE 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
C51 COMPILER V9.56.0.0, COMPILATION OF MODULE LCD
|
|
|
|
|
OBJECT MODULE PLACED IN lcd.OBJ
|
|
|
|
|
COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE lcd.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND TABS(2)
|
|
|
|
|
|
|
|
|
|
line level source
|
|
|
|
|
|
|
|
|
|
1 #include "lcd.h"
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
4 void Read_Busy() //æ<EFBFBD><EFBFBD><EFBFBD>⺯<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>bit7<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>У<EFBFBD>1<EFBFBD><EFBFBD>ֹ
|
|
|
|
|
5 {
|
|
|
|
|
6 1 unsigned char sta; //
|
|
|
|
|
7 1 LCD1602_DB = 0xff;
|
|
|
|
|
8 1 LCD1602_RS = 0;
|
|
|
|
|
9 1 LCD1602_RW = 1;
|
|
|
|
|
10 1 do
|
|
|
|
|
11 1 {
|
|
|
|
|
12 2 LCD1602_EN = 1;
|
|
|
|
|
13 2 sta = LCD1602_DB;
|
|
|
|
|
14 2 LCD1602_EN = 0; //ʹ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
15 2 }while(sta & 0x80);
|
|
|
|
|
16 1 }
|
|
|
|
|
17
|
|
|
|
|
18 void Lcd1602_Write_Cmd(unsigned char cmd) //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
19 {
|
|
|
|
|
20 1 Read_Busy();
|
|
|
|
|
21 1 LCD1602_RS = 0;
|
|
|
|
|
22 1 LCD1602_RW = 0;
|
|
|
|
|
23 1 LCD1602_DB = cmd;
|
|
|
|
|
24 1 LCD1602_EN = 1;
|
|
|
|
|
25 1 LCD1602_EN = 0;
|
|
|
|
|
26 1 }
|
|
|
|
|
27
|
|
|
|
|
28 void Lcd1602_Write_Data(unsigned char dat) //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
29 {
|
|
|
|
|
30 1 Read_Busy();
|
|
|
|
|
31 1 LCD1602_RS = 1;
|
|
|
|
|
32 1 LCD1602_RW = 0;
|
|
|
|
|
33 1 LCD1602_DB = dat;
|
|
|
|
|
34 1 LCD1602_EN = 1;
|
|
|
|
|
35 1 LCD1602_EN = 0;
|
|
|
|
|
36 1 }
|
|
|
|
|
37
|
|
|
|
|
38 void LcdSetCursor(unsigned char x,unsigned char y) //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
39 {
|
|
|
|
|
40 1 unsigned char addr;
|
|
|
|
|
41 1 if(y == 0)
|
|
|
|
|
42 1 addr = 0x00 + x;
|
|
|
|
|
43 1 else
|
|
|
|
|
44 1 addr = 0x40 + x;
|
|
|
|
|
45 1
|
|
|
|
|
46 1 Lcd1602_Write_Cmd(addr|0x80);
|
|
|
|
|
47 1 }
|
|
|
|
|
48
|
|
|
|
|
49 //<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾһ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
50 void DisplayOneChar(unsigned char X, unsigned char Y, unsigned char DData)
|
|
|
|
|
51 {
|
|
|
|
|
52 1 Y &= 0x1;
|
|
|
|
|
53 1 X &= 0xF; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>15<EFBFBD><EFBFBD>Y<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>1
|
|
|
|
|
54 1 if (Y) X |= 0x40; //<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ʾ<EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>+0x40;
|
|
|
|
|
55 1 X |= 0x80; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
C51 COMPILER V9.56.0.0 LCD 04/06/2022 22:23:01 PAGE 2
|
|
|
|
|
|
|
|
|
|
56 1 Lcd1602_Write_Cmd(X); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
57 1 Lcd1602_Write_Data(DData); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
58 1 }
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
|
|
61 void LcdShowStr(unsigned char x,unsigned char y,unsigned char *str) //<EFBFBD><EFBFBD>ʾ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
62 {
|
|
|
|
|
63 1 LcdSetCursor(x,y); //<EFBFBD><EFBFBD>ǰ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
64 1 while(*str != '\0')
|
|
|
|
|
65 1 {
|
|
|
|
|
66 2 Lcd1602_Write_Data(*str++);
|
|
|
|
|
67 2 }
|
|
|
|
|
68 1 }
|
|
|
|
|
69
|
|
|
|
|
70 void InitLcd1602() //1602<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|
|
|
|
71 {
|
|
|
|
|
72 1 Lcd1602_Write_Cmd(0x38); //<EFBFBD><EFBFBD>5*8,8λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
73 1 Lcd1602_Write_Cmd(0x0c);
|
|
|
|
|
74 1 Lcd1602_Write_Cmd(0x06);
|
|
|
|
|
75 1 Lcd1602_Write_Cmd(0x01); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
76 1 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MODULE INFORMATION: STATIC OVERLAYABLE
|
|
|
|
|
CODE SIZE = 157 ----
|
|
|
|
|
CONSTANT SIZE = ---- ----
|
|
|
|
|
XDATA SIZE = ---- ----
|
|
|
|
|
PDATA SIZE = ---- ----
|
|
|
|
|
DATA SIZE = ---- 3
|
|
|
|
|
IDATA SIZE = ---- ----
|
|
|
|
|
BIT SIZE = ---- ----
|
|
|
|
|
END OF MODULE INFORMATION.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
|