📄 main_lcd.lst
字号:
C51 COMPILER V8.02 MAIN_LCD 03/25/2006 14:31:32 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE MAIN_LCD
OBJECT MODULE PLACED IN main_lcd.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main_lcd.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <absacc.h>
2 #include <intrins.h>
3 #include <REGX52.h>
4 #define uint unsigned int
5 #define uchar unsigned char
6
7 #define add_iw_lr XBYTE[0x8300] //写指令(左右)地址
8 #define add_iw_l XBYTE[0x8200] //写指令(左)地址
9 #define add_iw_r XBYTE[0x8100] //写指令(右)地址
10 #define add_dw_lr XBYTE[0x8700] //写数据(左右)地址
11 #define add_dw_l XBYTE[0x8600] //写数据(左)地址
12 #define add_dw_r XBYTE[0x8500] //写数据(右)地址
13 #define add_rsta_lr XBYTE[0x8b00] //读状态地址
14 #define add_rd_lr XBYTE[0x8f00] //读显示数据地址
15
16 sbit lcdreset=P1^7; // LCD复位端口位地址
17 uchar s_c; //定义屏幕位置(0-左,1-右,2-全屏)
18
19 code char
20 _asc_20[]={0x00,0x00,0x00,0x00,0x00,0x00},//space
21 _asc_21[]={0x00,0x00,0x4f,0x00,0x00,0x00},//!
22 _asc_28[]={0x00,0x00,0x1c,0x22,0x41,0x00},//(
23 _asc_29[]={0x00,0x41,0x22,0x1c,0x00,0x00},//)
24 _asc_2a[]={0x14,0x08,0x3e,0x08,0x14,0x00},//*
25 _asc_2b[]={0x08,0x08,0x3e,0x08,0x08,0x00},//+
26 _asc_2c[]={0x00,0x50,0x30,0x00,0x00,0x00},//,
27 _asc_2d[]={0x08,0x08,0x08,0x08,0x08,0x00},//-
28 _asc_2e[]={0x00,0x60,0x60,0x00,0x00,0x00},//.
29
30 _asc_30[]={0x3e,0x51,0x49,0x45,0x3e,0x00},//0
31 _asc_31[]={0x00,0x42,0x7f,0x40,0x00,0x00},//1
32 _asc_32[]={0x42,0x61,0x51,0x49,0x46,0x00},//2
33 _asc_33[]={0x21,0x41,0x45,0x4b,0x31,0x00},//3
34 _asc_34[]={0x18,0x14,0x12,0x7f,0x10,0x00},//4
35 _asc_35[]={0x27,0x45,0x45,0x45,0x39,0x00},//5
36 _asc_36[]={0x3c,0x4a,0x49,0x49,0x30,0x00},//6
37 _asc_37[]={0x01,0x01,0x71,0x0d,0x03,0x00},//7
38 _asc_38[]={0x36,0x49,0x49,0x49,0x36,0x00},//8
39 _asc_39[]={0x06,0x49,0x49,0x29,0x1e,0x00},//9
40 _asc_3a[]={0x00,0x36,0x36,0x00,0x00,0x00},//:
41 _asc_3b[]={0x00,0x56,0x36,0x00,0x00,0x00},//;
42 //_asc_3c[]={0x00,0x08,0x14,0x22,0x41,0x00},//<
43 _asc_3c[]={0x00,0xfe,0x7c,0x38,0x10,0x00},//-> (替换成自定义符号)
44 _asc_3d[]={0x14,0x14,0x14,0x14,0x14,0x00},//=
45 _asc_3e[]={0x00,0x41,0x22,0x14,0x08,0x00},//>
46 _asc_3f[]={0x02,0x01,0x51,0x09,0x06,0x00},//?
47 _asc_40[]={0x3e,0x41,0x5d,0x55,0x1e,0x00},//@ (原来)
48 _asc_41[]={0x7e,0x11,0x11,0x11,0x7e,0x00},//A
49 _asc_42[]={0x7f,0x49,0x49,0x49,0x36,0x00},//B
50 _asc_43[]={0x3e,0x41,0x41,0x41,0x22,0x00},//C
51 _asc_44[]={0x7f,0x41,0x41,0x22,0x1c,0x00},//D
52 _asc_45[]={0x7f,0x49,0x49,0x49,0x41,0x00},//E
53 _asc_46[]={0x7f,0x09,0x09,0x09,0x01,0x00},//F
54 _asc_47[]={0x3e,0x41,0x49,0x49,0x7a,0x00},//G
55 _asc_48[]={0x7f,0x08,0x08,0x08,0x7f,0x00},//H
C51 COMPILER V8.02 MAIN_LCD 03/25/2006 14:31:32 PAGE 2
56 _asc_49[]={0x00,0x41,0x7f,0x41,0x00,0x00},//I
57 _asc_4a[]={0x20,0x40,0x41,0x3f,0x01,0x00},//J
58 _asc_4b[]={0x7f,0x08,0x14,0x22,0x41,0x00},//K
59 _asc_4c[]={0x7f,0x40,0x40,0x40,0x40,0x00},//L
60 _asc_4d[]={0x7f,0x02,0x0c,0x02,0x7f,0x00},//M
61 _asc_4e[]={0x7f,0x04,0x08,0x10,0x7f,0x00},//N
62 _asc_4f[]={0x3e,0x41,0x41,0x41,0x3e,0x00},//O
63 _asc_50[]={0x7f,0x09,0x09,0x09,0x06,0x00},//P
64 _asc_51[]={0x3e,0x41,0x51,0x21,0x5e,0x00},//Q
65 _asc_52[]={0x7f,0x09,0x19,0x29,0x46,0x00},//R
66 _asc_53[]={0x46,0x49,0x49,0x49,0x31,0x00},//S
67 _asc_54[]={0x01,0x01,0x7F,0x01,0x01,0x00},//T
68 _asc_55[]={0x3F,0x40,0x40,0x40,0x3F,0x00},//U
69 _asc_56[]={0x1F,0x20,0x40,0x20,0x3F,0x00},//V
70 _asc_57[]={0x3F,0x40,0x38,0x40,0x3F,0x00},//W
71 _asc_58[]={0x63,0x14,0x08,0x14,0x63,0x00},//X
72 _asc_59[]={0x03,0x04,0x78,0x04,0x03,0x00},//Y
73 _asc_5a[]={0x61,0x51,0x49,0x45,0x43,0x00},//Z
74
75 _asc_61[]={0x20,0x54,0x54,0x54,0x78,0x00},//a
76 _asc_62[]={0x7f,0x48,0x44,0x44,0x38,0x00},//b
77 _asc_63[]={0x38,0x44,0x44,0x44,0x44,0x00},//c
78 _asc_64[]={0x38,0x44,0x44,0x48,0x7f,0x00},//d
79 _asc_65[]={0x38,0x54,0x54,0x54,0x18,0x00},//e
80 _asc_66[]={0x08,0x7e,0x09,0x01,0x02,0x00},//f
81 _asc_67[]={0x06,0x49,0x49,0x49,0x3e,0x00},//g
82 _asc_68[]={0x7f,0x08,0x04,0x04,0x78,0x00},//h
83 _asc_69[]={0x00,0x44,0x7d,0x40,0x00,0x00},//i
84 _asc_6a[]={0x20,0x40,0x44,0x3d,0x00,0x00},//j
85 _asc_6b[]={0x7f,0x10,0x28,0x44,0x00,0x00},//k
86 _asc_6c[]={0x00,0x41,0x7f,0x40,0x00,0x00},//l
87 _asc_6d[]={0x7c,0x04,0x18,0x04,0x78,0x00},//m
88 _asc_6e[]={0x7c,0x08,0x04,0x04,0x78,0x00},//n
89 _asc_6f[]={0x38,0x44,0x44,0x44,0x38,0x00},//o
90 _asc_70[]={0x7c,0x14,0x14,0x14,0x08,0x00},//p
91 _asc_71[]={0x08,0x14,0x14,0x14,0x7c,0x00},//q
92 _asc_72[]={0x00,0x7c,0x08,0x04,0x04,0x00},//r
93 _asc_73[]={0x48,0x54,0x54,0x54,0x20,0x00},//s
94 _asc_74[]={0x00,0x04,0x3f,0x44,0x40,0x00},//t
95 _asc_75[]={0x3c,0x40,0x40,0x20,0x7c,0x00},//u
96 _asc_76[]={0x1c,0x20,0x40,0x20,0x1c,0x00},//v
97 _asc_77[]={0x3c,0x40,0x30,0x40,0x3c,0x00},//w
98 _asc_78[]={0x44,0x28,0x10,0x28,0x44,0x00},//x
99 _asc_79[]={0x0c,0x50,0x50,0x50,0x3c,0x00},//y
100 _asc_7a[]={0x44,0x64,0x54,0x4c,0x44,0x00};//z
101
102 code char code *ascii[]={
103 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
104 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
105 _asc_20,_asc_21,
106 0,0,0,0,0,0,
107 _asc_28,_asc_29,_asc_2a,_asc_2b,_asc_2c,_asc_2d,_asc_2e,0,
108 _asc_30,_asc_31,_asc_32,_asc_33,_asc_34,_asc_35,_asc_36,_asc_37,_asc_38,_asc_39,
109 _asc_3a,_asc_3b,_asc_3c,_asc_3d,_asc_3e,_asc_3f,
110 0,
111 _asc_41,_asc_42,_asc_43,_asc_44,_asc_45,_asc_46,_asc_47,_asc_48,_asc_49,_asc_4a,
112 _asc_4b,_asc_4c,_asc_4d,_asc_4e,_asc_4f,_asc_50,_asc_51,_asc_52,_asc_53,_asc_54,
113 _asc_55,_asc_56,_asc_57,_asc_58,_asc_59,_asc_5a,
114 0,0,0,0,0,0,
115 _asc_61,_asc_62,_asc_63,_asc_64,_asc_65,_asc_66,_asc_67,_asc_68,_asc_69,_asc_6a,
116 _asc_6b,_asc_6c,_asc_6d,_asc_6e,_asc_6f,_asc_70,_asc_71,_asc_72,_asc_73,_asc_74,
117 _asc_75,_asc_76,_asc_77,_asc_78,_asc_79,_asc_7a,
C51 COMPILER V8.02 MAIN_LCD 03/25/2006 14:31:32 PAGE 3
118 0,0,0,0,0};
119
120
121
122 /*----------------------------------------------------------------------------------------------------*/
123 /*--基本函数源程序------------------------------------------------------------------------------------*/
124
125 //延时
126 Lcd12864delay(uint i)
127 {
128 1 while(i--) {;}
129 1 }
130 /*----------------------------------------------------------------------------------------------------*/
131 //状态检查
132 void CheckState()
133 {
134 1 uchar dat;
135 1 do{dat=add_rsta_lr;
136 2 dat=0x90 & dat; //仅当第4,7位为0时才可操作
137 2 }while(!(dat==0x00));
138 1 }
139 /*----------------------------------------------------------------------------------------------------*/
140 //写显示数据
141 //dat:显示数据
142 void WriteByte(uchar dat,s_c)
143 {
144 1 switch(s_c)
145 1 {case 0: //写左显示数据
146 2 CheckState();
147 2 add_dw_l=dat;
148 2 break;
149 2
150 2 case 1: //写右显示数据
151 2 CheckState();
152 2 add_dw_r=dat;
153 2 break;
154 2
155 2 case 2: //写左右显示数据
156 2 CheckState();
157 2 add_dw_lr=dat;
158 2 break;
159 2 }
160 1 }
161 /*-----------------------------------------------------------------------------------------------------*/
162 //向LCD发送命令
163 //command :命令
164 SendCommandToLCD(uchar command,s_c)
165 {
166 1 switch(s_c)
167 1 {case 0: //写左指令
168 2 CheckState();
169 2 add_iw_l=command;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -