|
|
|
|
C51 COMPILER V9.56.0.0 LCD 04/30/2022 18:10:32 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 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : Lcd1602_Delay1ms
|
|
|
|
|
5 * <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ1ms
|
|
|
|
|
6 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : c
|
|
|
|
|
7 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : <EFBFBD><EFBFBD>
|
|
|
|
|
8 * ˵ <EFBFBD><EFBFBD> : <EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>12MHZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>12<EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
9 *******************************************************************************/
|
|
|
|
|
10
|
|
|
|
|
11 void Lcd1602_Delay1ms(uint c) //<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0us
|
|
|
|
|
12 {
|
|
|
|
|
13 1 uchar a,b;
|
|
|
|
|
14 1 for (; c>0; c--)
|
|
|
|
|
15 1 {
|
|
|
|
|
16 2 for (b=199;b>0;b--)
|
|
|
|
|
17 2 {
|
|
|
|
|
18 3 for(a=1;a>0;a--);
|
|
|
|
|
19 3 }
|
|
|
|
|
20 2 }
|
|
|
|
|
21 1
|
|
|
|
|
22 1 }
|
|
|
|
|
23
|
|
|
|
|
24 /*******************************************************************************
|
|
|
|
|
25 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : LcdWriteCom
|
|
|
|
|
26 * <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD>LCDд<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ֽڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
27 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : com
|
|
|
|
|
28 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : <EFBFBD><EFBFBD>
|
|
|
|
|
29 *******************************************************************************/
|
|
|
|
|
30 #ifndef LCD1602_4PINS //<EFBFBD><EFBFBD>û<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>LCD1602_4PINSʱ
|
|
|
|
|
31 void LcdWriteCom(uchar com) //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
32 {
|
|
|
|
|
33 1 LCD1602_E = 0; //ʹ<EFBFBD><EFBFBD>
|
|
|
|
|
34 1 LCD1602_RS = 0; //ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
35 1 LCD1602_RW = 0; //ѡ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>
|
|
|
|
|
36 1
|
|
|
|
|
37 1 LCD1602_DATAPINS = com; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
38 1 Lcd1602_Delay1ms(1); //<EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȶ<EFBFBD>
|
|
|
|
|
39 1
|
|
|
|
|
40 1 LCD1602_E = 1; //д<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
41 1 Lcd1602_Delay1ms(5); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
42 1 LCD1602_E = 0;
|
|
|
|
|
43 1 }
|
|
|
|
|
44 #else
|
|
|
|
|
void LcdWriteCom(uchar com) //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
LCD1602_E = 0; //ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
LCD1602_RS = 0; //ѡ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
LCD1602_RW = 0; //ѡ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
LCD1602_DATAPINS = com; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>4λ<EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽӵ<EFBFBD>P0<EFBFBD>ڵĸ<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD>
|
|
|
|
|
Lcd1602_Delay1ms(1);
|
|
|
|
|
|
|
|
|
|
LCD1602_E = 1; //д<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
Lcd1602_Delay1ms(5);
|
|
|
|
|
C51 COMPILER V9.56.0.0 LCD 04/30/2022 18:10:32 PAGE 2
|
|
|
|
|
|
|
|
|
|
LCD1602_E = 0;
|
|
|
|
|
|
|
|
|
|
// Lcd1602_Delay1ms(1);
|
|
|
|
|
LCD1602_DATAPINS = com << 4; //<EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD>λ
|
|
|
|
|
Lcd1602_Delay1ms(1);
|
|
|
|
|
|
|
|
|
|
LCD1602_E = 1; //д<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
Lcd1602_Delay1ms(5);
|
|
|
|
|
LCD1602_E = 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
67 /*******************************************************************************
|
|
|
|
|
68 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : LcdWriteData
|
|
|
|
|
69 * <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD>LCDд<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ֽڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
70 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : dat
|
|
|
|
|
71 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : <EFBFBD><EFBFBD>
|
|
|
|
|
72 *******************************************************************************/
|
|
|
|
|
73 #ifndef LCD1602_4PINS
|
|
|
|
|
74 void LcdWriteData(uchar dat) //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
75 {
|
|
|
|
|
76 1 LCD1602_E = 0; //ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
77 1 LCD1602_RS = 1; //ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
78 1 LCD1602_RW = 0; //ѡ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>
|
|
|
|
|
79 1
|
|
|
|
|
80 1 LCD1602_DATAPINS = dat; //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
81 1 Lcd1602_Delay1ms(1);
|
|
|
|
|
82 1
|
|
|
|
|
83 1 LCD1602_E = 1; //д<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
84 1 Lcd1602_Delay1ms(5); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
85 1 LCD1602_E = 0;
|
|
|
|
|
86 1 }
|
|
|
|
|
87 #else
|
|
|
|
|
void LcdWriteData(uchar dat) //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
LCD1602_E = 0; //ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
LCD1602_RS = 1; //ѡ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
LCD1602_RW = 0; //ѡ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
LCD1602_DATAPINS = dat; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>4λ<EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽӵ<EFBFBD>P0<EFBFBD>ڵĸ<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD>
|
|
|
|
|
Lcd1602_Delay1ms(1);
|
|
|
|
|
|
|
|
|
|
LCD1602_E = 1; //д<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
Lcd1602_Delay1ms(5);
|
|
|
|
|
LCD1602_E = 0;
|
|
|
|
|
|
|
|
|
|
LCD1602_DATAPINS = dat << 4; //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
|
|
|
|
Lcd1602_Delay1ms(1);
|
|
|
|
|
|
|
|
|
|
LCD1602_E = 1; //д<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
Lcd1602_Delay1ms(5);
|
|
|
|
|
LCD1602_E = 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
109 /*******************************************************************************
|
|
|
|
|
110 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : LcdInit()
|
|
|
|
|
111 * <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>LCD<EFBFBD><EFBFBD>
|
|
|
|
|
112 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : <EFBFBD><EFBFBD>
|
|
|
|
|
113 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : <EFBFBD><EFBFBD>
|
|
|
|
|
114 *******************************************************************************/
|
|
|
|
|
115 #ifndef LCD1602_4PINS
|
|
|
|
|
116 void LcdInit() //LCD<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
117 {
|
|
|
|
|
C51 COMPILER V9.56.0.0 LCD 04/30/2022 18:10:32 PAGE 3
|
|
|
|
|
|
|
|
|
|
118 1 LcdWriteCom(0x38); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
119 1 LcdWriteCom(0x0c); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
120 1 LcdWriteCom(0x06); //дһ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1
|
|
|
|
|
121 1 LcdWriteCom(0x01); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
122 1 LcdWriteCom(0x80); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
123 1 }
|
|
|
|
|
124 #else
|
|
|
|
|
void LcdInit() //LCD<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
LcdWriteCom(0x32); //<EFBFBD><EFBFBD>8λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>תΪ4λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
LcdWriteCom(0x28); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD>µij<EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|
|
|
|
LcdWriteCom(0x0c); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
LcdWriteCom(0x06); //дһ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1
|
|
|
|
|
LcdWriteCom(0x01); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
LcdWriteCom(0x80); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MODULE INFORMATION: STATIC OVERLAYABLE
|
|
|
|
|
CODE SIZE = 87 ----
|
|
|
|
|
CONSTANT SIZE = ---- ----
|
|
|
|
|
XDATA SIZE = ---- ----
|
|
|
|
|
PDATA SIZE = ---- ----
|
|
|
|
|
DATA SIZE = ---- ----
|
|
|
|
|
IDATA SIZE = ---- ----
|
|
|
|
|
BIT SIZE = ---- ----
|
|
|
|
|
END OF MODULE INFORMATION.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
|