📄 register_lcd_driver.lst
字号:
ARM COMPILER V2.42, Register_LCD_Driver 06/03/07 11:32:18 PAGE 1
ARM COMPILER V2.42, COMPILATION OF MODULE Register_LCD_Driver
OBJECT MODULE PLACED IN Register_LCD_Driver.OBJ
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe Register_LCD_Driver.c THUMB DEBUG TABS(4)
stmt level source
1 /*********************************************************************
2
3 Author : ADI - Apps www.analog.com/MicroConverter
4
5 Date : August 2006
6
7 File : Register_LCD_Driver.c
8
9 Hardware : Applicable to ADuC702x rev H or I silicon
10
11 Description : This file provides the routines necessary to interface
12 to a Register based LCD display module.
13
14 *********************************************************************/
15
16 #include <ADuC7020.h> // Include ADuC7020 Header File
17 #include <Register_LCD_Driver.h>
18
19 unsigned long ulValue = 0;
20 volatile unsigned char RdStatus = 0;
21
22
23 unsigned char Init_MC08_LCD()
24 {
25 1 GP0DAT = 0xA0000000; // P0.5 = RS, E = P0.7
26 1 GP1DAT = 0xFF000000; // P1.[7..0] = DB[0..7]
27 1 GP2DAT = 0x01000000; // P2.0 = R/W
28 1
29 1 return 0x1;
30 1 }
31 unsigned char Select_Function_Set(unsigned char ucFunctionSet)
32 {
33 1 unsigned long ulFunction = 0;
34 1
35 1 delay (10000);
36 1 RdStatus = ReadStatus();
37 1
38 1 ulFunction = ucFunctionSet;
39 1 ulFunction = (ulFunction << 16);
40 1 ulFunction |= 0xFF000000;
41 1
42 1 GP0DAT = 0xA0000000; // Clear RS pin(P0.5), clear E pin (P0.7) -> R/W)
43 1 GP2DAT = 0x01000000; // Clear R/W pin (P2.0 -> R/W)
44 1 delay (5);
45 1
46 1 GP0SET = 0x800000; // Set E high
47 1 delay (5); // allow min 800ns Setup time
48 1 GP1DAT = ulFunction; // Write to register
49 1 delay (5); // allow Hold time of 500nS min
50 1 GP0CLR = 0x800000; // Set E low
51 1 delay (5);
52 1
53 1 return 0x1;
54 1 }
55
56 unsigned char Set_DDRAM_ADDR_LCD(unsigned char addr)
57 {
58 1 unsigned long ulAddr = 0;
59 1
ARM COMPILER V2.42, Register_LCD_Driver 06/03/07 11:32:18 PAGE 2
60 1 delay (10000);
61 1 addr |= 0x80; // Set MSB of register
62 1 ulAddr = addr;
63 1 ulAddr = (ulAddr << 16);
64 1 ulAddr |= 0xFF000000;
65 1
66 1 GP1DAT |= ulAddr; // Write to register
67 1 //Set RS pin of LCD low for Register access
68 1 GP2DAT = 0x01000000; // Set RS pin of LCD low for Register access (P2.0 -> RS)
69 1 GP0DAT = 0x40000000; // Clear R/W pin. (P0.6 -> R/W)
70 1 GP0DAT = 0xC0800000; // Set E pin. (P0.7 -> E)
71 1
72 1
73 1 delay(500);
74 1 GP0DAT = 0xC0000000; // Clear E pin. (P0.7 -> E)
75 1 GP1DAT = 0x00300000; // Configure data bus as Input
76 1
77 1 return 0x1;
78 1 }
79
80 unsigned char Display_On_LCD(void)
81 {
82 1 GP1DAT = 0xFF0F0000; // Write 0x0F - Turn on Display, cursor on and blinking
83 1 //Set RS pin of LCD low for Register access
84 1 GP2DAT = 0x01000000; // Set RS pin of LCD low for Register access (P2.0 -> RS)
85 1 GP0DAT = 0x40000000; // Clear R/W pin. (P0.6 -> R/W)
86 1 GP0DAT = 0xC0800000; // Set E pin. (P0.7 -> E)
87 1
88 1 delay(500);
89 1 GP0DAT = 0xC0000000; // CLear E pin. (P0.7 -> E)
90 1 GP1DAT = 0x00300000; // Configure data bus as Input
91 1 return 0x1;
92 1 }
93 unsigned char Display_Off_LCD(unsigned char ucFunctionSet)
94 {
95 1 GP1DAT = 0xFF0B0000; // Write 0x0B - Turn off Display
96 1 //Set RS pin of LCD low for Register access
97 1 GP2DAT = 0x01000000; // Set RS pin of LCD low for Register access (P2.0 -> RS)
98 1 GP0DAT = 0x40000000; // Clear R/W pin. (P0.6 -> R/W)
99 1 GP0DAT = 0xC0800000; // Set E pin. (P0.7 -> E)
100 1
101 1 delay(500);
102 1 GP0DAT = 0xC0000000; // Clear E pin. (P0.7 -> E)
103 1 GP1DAT = 0x00300000; // Configure data bus as Input
104 1 return 0x1;
105 1 }
*** WARNING C47 IN LINE 93 OF REGISTER_LCD_DRIVER.C: 'ucFunctionSet': unreferenced parameter
106 unsigned char Clear_Display_LCD(unsigned char ucFunctionSet)
107 {
108 1 unsigned long ulFunction = 0;
109 1
110 1 delay (10000);
111 1 RdStatus = ReadStatus();
112 1 ulFunction = ucFunctionSet;
113 1 ulFunction = (ulFunction << 16);
114 1 ulFunction |= 0xFF000000;
115 1
116 1 GP0DAT = 0xA0000000; // Clear RS pin(P0.5), clear E pin (P0.7) -> R/W)
117 1 GP2DAT = 0x01000000; // Clear R/W pin (P2.0 -> R/W)
118 1 delay (5);
119 1
120 1 GP0SET = 0x800000; // Set E high
121 1 delay (5); // Allow min 800ns Setup time
122 1 GP1DAT = ulFunction; // Write to register
123 1 delay (5); // Allow Hold time of 500nS min
124 1 GP0CLR = 0x800000; // Set E low
ARM COMPILER V2.42, Register_LCD_Driver 06/03/07 11:32:18 PAGE 3
125 1 delay (2000); // Minimum clear time of 1.58mS
126 1
127 1 return 0x1;
128 1 }
129 unsigned char Set_Entry_Mode(unsigned char ucFunctionSet)
130 {
131 1 unsigned long ulFunction = 0;
132 1
133 1 delay (10000);
134 1 RdStatus = ReadStatus();
135 1 ulFunction = ucFunctionSet;
136 1 ulFunction = (ulFunction << 16);
137 1 ulFunction |= 0xFF000000;
138 1
139 1 GP0DAT = 0xA0000000; // Clear RS pin(P0.5), clear E pin (P0.7) -> R/W)
140 1 GP2DAT = 0x01000000; // Clear R/W pin (P2.0 -> R/W)
141 1 delay (5);
142 1
143 1 GP0SET = 0x800000; // Set E high
144 1 delay (5); // allow min 800ns Setup time
145 1 GP1DAT = ulFunction; // Write to register
146 1 delay (5); // allow Hold time of 500nS min
147 1 GP0CLR = 0x800000; // Set E low
148 1 delay (5);
149 1
150 1 return 0x1;
151 1 }
152 unsigned char Wr_Data_LCD(unsigned char ucFunctionSet)
153 {
154 1 unsigned long ulFunction = 0;
155 1
156 1 delay (10000);
157 1 RdStatus = ReadStatus();
158 1 ulFunction = ucFunctionSet;
159 1 ulFunction = (ulFunction << 16);
160 1 ulFunction |= 0xFF000000;
161 1
162 1 GP0DAT = 0xA0200000; // Set RS pin(P0.5), clear E pin (P0.7) -> R/W)
163 1 GP2DAT = 0x01000000; // Clear R/W pin (P2.0 -> R/W)
164 1 delay (5);
165 1
166 1 GP0SET = 0x800000; // Set E high
167 1 delay (5); // allow min 800ns Setup time
168 1 GP1DAT = ulFunction; // Write to register
169 1 delay (5); // allow Hold time of 500nS min
170 1 GP0CLR = 0x800000; // Set E low
171 1
172 1 delay (5);
173 1 GP0CLR = 0x200000; // Set RS low
174 1
175 1 return 0x1;
176 1 }
177 unsigned char ReadStatus(void)
178 {
179 1 unsigned long ulFunction = 0;
180 1 unsigned char Status = 0;
181 1
182 1 delay (10000);
183 1
184 1 GP1DAT = 0x00000000; // Set Port 1 to input mode
185 1 GP0DAT = 0xA0000000; // Clear RS pin(P0.5), clear E pin (P0.7) -> R/W)
186 1 GP2DAT = 0x01010000; // Clear R/W pin (P2.0 -> R/W)
187 1 delay (5);
188 1
189 1 GP0SET = 0x800000; // Set E high
190 1 delay (5); // allow min 800ns Setup time
ARM COMPILER V2.42, Register_LCD_Driver 06/03/07 11:32:18 PAGE 4
191 1 Status = (unsigned char)GP1DAT; // Write to register
192 1 delay (5); // allow Hold time of 500nS min
193 1 GP0CLR = 0x800000; // Set E low
194 1
195 1 delay (5);
196 1 GP2CLR = 0x10000; // Clear R/W
197 1
198 1 return Status;
199 1 }
200
201 void delay (int length)
202 {
203 1 while (length >0)
204 1 length--;
205 1 }
206
207
208
ARM COMPILER V2.42, Register_LCD_Driver 06/03/07 11:32:18 PAGE 5
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** PUBLICS:
PUBLIC Init_MC08_LCD?T
PUBLIC Select_Function_Set?T
PUBLIC Display_On_LCD?T
PUBLIC Display_Off_LCD?T
PUBLIC Clear_Display_LCD?T
PUBLIC Set_Entry_Mode?T
PUBLIC Wr_Data_LCD?T
PUBLIC Set_DDRAM_ADDR_LCD?T
PUBLIC ReadStatus?T
PUBLIC delay?T
PUBLIC ulValue
PUBLIC RdStatus
*** DATA SEGMENT '?DT0?Register_LCD_Driver':
00000000 ulValue:
00000000 BEGIN_INIT
00000000 00000000 DD 0x0
00000004 END_INIT
00000004 RdStatus:
00000004 BEGIN_INIT
00000004 00 DB 0x0
00000005 END_INIT
*** CODE SEGMENT '?PR?Init_MC08_LCD?T?Register_LCD_Driver':
25: GP0DAT = 0xA0000000; // P0.5 = RS, E = P0.7
00000000 4800 LDR R1,=0xA0000000
00000002 4800 LDR R0,=0xFFFFF420
00000004 6001 STR R1,[R0,#0x0]
26: GP1DAT = 0xFF000000; // P1.[7..0] = DB[0..7]
00000006 4800 LDR R1,=0xFF000000
00000008 4800 LDR R0,=0xFFFFF430
0000000A 6001 STR R1,[R0,#0x0]
27: GP2DAT = 0x01000000; // P2.0 = R/W
0000000C 4800 LDR R1,=0x1000000
0000000E 4800 LDR R0,=0xFFFFF440
00000010 6001 STR R1,[R0,#0x0]
29: return 0x1;
00000012 2001 MOV R0,#0x1
30: }
00000014 4770 BX R14
00000016 ENDP ; 'Init_MC08_LCD?T'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -