📄 pg160128a.lst
字号:
C51 COMPILER V7.06 PG160128A 05/16/2009 11:06:12 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE PG160128A
OBJECT MODULE PLACED IN PG160128A.OBJ
COMPILER INVOKED BY: D:\keil\C51\BIN\C51.EXE PG160128A.C LARGE BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include <absacc.h>
2 #include <reg51.h>
3 //#include <rtx51tny.h>
4 #include <stdarg.h>
5 #include <stdio.h>
6 #include"picture.h"
7
8 #define ulong unsigned long
9 #define uint unsigned int
10 #define uchar unsigned char
11 #define STX 0x02
12 #define ETX 0x03
13 #define EOT 0x04
14 #define ENQ 0x05
15 #define BS 0x08
16 #define CR 0x0D
17 #define LF 0x0A
18 #define DLE 0x10
19 #define ETB 0x17
20 #define SPACE 0x20
21 #define COMMA 0x2C
22 #define TRUE 1
23 #define FALSE 0
24 #define HIGH 1
25 #define LOW 0
26
27 extern uchar scankeypad ();
28
29
30 /* T6963C 端口定义 */
31 #define LCMDW XBYTE[0x08000] /* 数据口 */
32 #define LCMCW XBYTE[0x08100] /* 命令口 */
33
34
35 /* T6963C 命令定义 */
36 #define LC_CUR_POS 0x21 /* 光标位置设置 */
37 #define LC_CGR_POS 0x22 /* CGRAM偏置地址设置 */
38 #define LC_ADD_POS 0x24 /* 地址指针位置 */
39 #define LC_TXT_STP 0x40 /* 文本区首址 */
40 #define LC_TXT_WID 0x41 /* 文本区宽度 */
41 #define LC_GRH_STP 0x42 /* 图形区首址 */
42 #define LC_GRH_WID 0x43 /* 图形区宽度 */
43 #define LC_MOD_OR 0x80 /* 显示方式:逻辑"或" */
44 #define LC_MOD_XOR 0x81 /* 显示方式:逻辑"异或" */
45 #define LC_MOD_AND 0x82 /* 显示方式:逻辑"与" */
46 #define LC_MOD_TCH 0x83 /* 显示方式:文本特征 */
47 #define LC_DIS_SW 0x90 /* 显示开关: */
48 /* D0=1/0:光标闪烁启用/禁用; */
49 /* D1=1/0:光标显示启用/禁用; */
50 /* D2=1/0:文本显示启用/禁用; */
51 /* D3=1/0:图形显示启用/禁用; */
52 #define LC_CUR_SHP 0xA0 /* 光标形状选择:0xA0-0xA7 表示光标占的行数 */
53 #define LC_AUT_WR 0xB0 /* 自动写设置 */
54 #define LC_AUT_RD 0xB1 /* 自动读设置 */
55 #define LC_AUT_OVR 0xB2 /* 自动读/写结束 */
C51 COMPILER V7.06 PG160128A 05/16/2009 11:06:12 PAGE 2
56 #define LC_INC_WR 0xC0 /* 数据一次写,地址加1 */
57 #define LC_INC_RD 0xC1 /* 数据一次读,地址加1 */
58 #define LC_DEC_WR 0xC2 /* 数据一次写,地址减1 */
59 #define LC_DEC_RD 0xC3 /* 数据一次读,地址减1 */
60 #define LC_NOC_WR 0xC4 /* 数据一次写,地址不变 */
61 #define LC_NOC_RD 0xC5 /* 数据一次读,地址不变 */
62 #define LC_SCN_RD 0xE0 /* 屏读 */
63 #define LC_SCN_CP 0xE8 /* 屏拷贝 */
64 #define LC_BIT_OP 0xF0 /* 位操作 */
65
66
67 /* ASCII 字模宽度及高度定义 */
68 #define ASC_CHR_WIDTH 8
69 #define ASC_CHR_HEIGHT 16
70
71
72
73 uchar gCurRow,gCurCol; /* 当前行、列存储,行高16点,列宽8点 */
74
75 /**************************** 获取当前行函数 *****************************
76 * 功能:将当前行数据返回给主调函数。
77 **************************************************************************/
78 uchar fnGetRow(void) {
79 1 return gCurRow;
80 1 }
81
82 /**************************** 获取当前列函数 *****************************
83 * 功能:将当前列数据返回给主调函数。
84 **************************************************************************/
85 uchar fnGetCol(void) {
86 1 return gCurCol;
87 1 }
88
89 /********************** 状态位ST1,ST0 判断函数 *************************
90 * 功能:读写指令和读写数据。
91 ************************************************************************/
92 uchar fnST01(void) {
93 1 uchar i;
94 1 for(i=10;i>0;i--) {
95 2 if((LCMCW & 0x03) == 0x03)
96 2 break;
97 2 }
98 1 return i; /* 若返回零,说明错误 */
99 1 }
100
101 /************************** 状态位ST2判断函数 ***************************
102 * 功能:数据自动读取。
103 ************************************************************************/
104 uchar fnST2(void) {
105 1 uchar i;
106 1 for(i=10;i>0;i--) {
107 2 if((LCMCW & 0x04) == 0x04)
108 2 break;
109 2 }
110 1 return i; /* 若返回零,说明错误 */
111 1 }
112
113 /*************************** * 状态位ST3判断函数 ************************
114 * 功能:数据自动写
115 ************************************************************************/
116 uchar fnST3(void) {
117 1 uchar i;
C51 COMPILER V7.06 PG160128A 05/16/2009 11:06:12 PAGE 3
118 1 for(i=10;i>0;i--) {
119 2 if((LCMCW & 0x08) == 0x08)
120 2 break;
121 2 }
122 1 return i; /* 若返回零,说明错误 */
123 1 }
124
125 /***************************** 状态位ST6判断函数 ************************
126 * 功能:屏读/屏拷贝
127 ************************************************************************/
128 uchar fnST6(void) {
129 1 uchar i;
130 1 for(i=10;i>0;i--) {
131 2 if((LCMCW & 0x40) == 0x40)
132 2 break;
133 2 }
134 1 return i; /* 若返回零,说明屏读/拷贝正确 */
135 1 }
136
137 /***************************** 写双参数命令函数 **************************/
138 uchar fnPR1(uchar uCmd,uchar uPar1,uchar uPar2) {
139 1 if(fnST01() == 0)
140 1 return 1;
141 1 LCMDW = uPar1;
142 1 if(fnST01() == 0)
143 1 return 2;
144 1 LCMDW = uPar2;
145 1 if(fnST01() == 0)
146 1 return 3;
147 1 LCMCW = uCmd;
148 1 return 0; /* 返回0 成功 */
149 1 }
150
151 /***************************** 写单参数命令函数 **************************/
152 uchar fnPR11(uchar uCmd,uchar uPar1) {
153 1 if(fnST01() == 0)
154 1 return 1;
155 1 LCMDW = uPar1;
156 1 if(fnST01() == 0)
157 1 return 2;
158 1 LCMCW = uCmd;
159 1 return 0; /* 返回0 成功 */
160 1 }
161
162 /***************************** 写无参数命令函数 **************************/
163 uchar fnPR12(uchar uCmd) {
164 1 if(fnST01() == 0)
165 1 return 1;
166 1 LCMCW = uCmd;
167 1 return 0; /* 返回0 成功 */
168 1 }
169
170 /***************************** 写数据函数 **************************/
171 uchar fnPR13(uchar uData) {
172 1 if(fnST3() == 0)
173 1 return 1;
174 1 LCMDW = uData;
175 1 return 0; /* 返回0 成功 */
176 1 }
177
178 /******************************* 读数据函数 ****************************/
179 uchar fnPR2(void) {
C51 COMPILER V7.06 PG160128A 05/16/2009 11:06:12 PAGE 4
180 1 if(fnST01() == 0)
181 1 return 1;
182 1 return LCMDW;
183 1 }
184
185 /************************** 设置当前地址函数 ***************************/
186 void fnSetPos(uchar urow, uchar ucol) {
187 1 uint iPos;
188 1 iPos = urow * 20 + ucol;
189 1 fnPR1(LC_ADD_POS,(uchar)(iPos),(uchar)(iPos>>8));
190 1 gCurRow = urow;
191 1 gCurCol = ucol;
192 1 }
193
194 /************************** 设置当前地址函数 ***************************/
195 void fnSetPos1(uchar urow, uchar ucol) {
196 1 uint iPos;
197 1 iPos = urow * 20 + ucol+0x0a00;
198 1 fnPR1(LC_ADD_POS,(uchar)(iPos),(uchar)(iPos>>8));
199 1 gCurRow = urow;
200 1 gCurCol = ucol;
201 1 }
202
203 /************************** 设置文本当前地址函数 第二页 ***************************/
204 void fnSetPostxt(uchar urow, uchar ucol) {
205 1 uint iPos;
206 1 iPos = urow * 20 + ucol+0x1d7f;
207 1 fnPR1(LC_ADD_POS,(uchar)(iPos),(uchar)(iPos>>8));
208 1 //gCurRow = urow;
209 1 //gCurCol = ucol;
210 1 }
211
212 /************************ 设置当前显示行、列函数 ************************/
213 void cursor(uchar uRow, uchar uCol) {
214 1 fnSetPos(uRow * 16, uCol);
215 1 }
216 /************************ 设置当前显示行、列函数第二页 ************************/
217 void cursor1(uchar uRow, uchar uCol) {
218 1 fnSetPos1(uRow * 16, uCol);
219 1 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -