?? main.lst
字號:
C51 COMPILER V7.50 MAIN 01/03/2006 14:59:51 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE MODDP2 DEBUG OBJECTEXTEND
line level source
1 #include"reg1210.h"
2
3 #define uchar unsigned char
4 #define uint unsigned int
5
6 sbit CS = P2^4;
7 sbit RES = P2^5;
8 sbit BS1 = P2^6;
9 sbit DC = P2^7;
10 sbit RW = P3^6;
11 sbit E = P3^7;
12
13 /************************** LCD Registers ***************************/
14
15 //Set Address
16 #define X_ADRESS 0x75 /* Set Row address, 3 byte */
17 #define Y_ADRESS 0x15 /* Set Column Address, 3 byte */
18
19 #define Contrast 0x81 /* Set Contrast Control, 2 byte */
20
21 //Set Current Range
22 #define QuarterCurr 0x84 /* Quarter Current Range, 1 byte */
23 #define HalfCurr 0x85 /* Half Current Range, 1 byte */
24 #define FullCurr 0x86 /* Full Current Range, 1 byte */
25
26 #define Re_map 0xA0 /* Set Re-map, 2 byte */
27
28 #define StartLine 0xA1 /* Set Display Start Line, 2 byte */
29
30 #define DispOffset 0xA2 /* Set Display Offset, 2 byte */
31
32 //Set Display Mode
33 #define NormDisp 0xA4 /* Normal Display, 1 byte */
34 #define DispAllOn 0xA5 /* Entire Display On, all pixels turns on in GS, 1 byte */
35 #define DispAllOff 0xA6 /* Entire Display Off, all pixels turns off, 1 byte */
36 #define InverseDisp 0xA7 /* Inverse Display, 1 byte */
37
38 #define MultiRadio 0xA8 /* Set Multiplex Ratio, 2 byte */
39
40 #define MasterConfig 0xAD /* Set Master Configuration, 2 byte */
41
42 //Set Display On/Off
43 #define Display_Off 0xAE /* Display Off (Sleep mode), 1 byte */
44 #define Display_On 0xAF /* Display On, 1 byte */
45
46 //Set Pre-charge Compensation
47 #define EnCompensate 0xB0 /* Set Pre-charge Compensation Enable, 2 byte */
48 #define LvCompensate 0xB4 /* Set Pre-charge Compensation Level, 2 byte */
49
50 #define SegmentLow 0xBF /* Set Segment Low Voltage(VSL), 2 byte */
51
52 #define VCOMH 0xBE /* Set VCOMH Voltage, 2 byte */
53
54 #define Precharge 0xBC /* Set Precharge Voltage, 2 byte */
55
C51 COMPILER V7.50 MAIN 01/03/2006 14:59:51 PAGE 2
56 #define PhaseLength 0xB1 /* Set Phase Length, 3 byte */
57
58 #define RowPeriod 0xB2 /* Set Row Period, 2 byte */
59
60 #define DispClock 0xB3 /* Set Display Clock Divide Ratio/Oscillator Frequency, 3 byte */
61
62 #define GrayScale 0xB8 /* Set Gray Scale Table, byte */
63
64 #define BiasCurr 0xCF /* Set Biasing Current for DC-DC converter, 2 byte */
65
66
67 /********************延時************************/
68 void delay(uint i)
69 {
70 1 uint j;
71 1 for(j=0; j<i ;j++)
72 1 {
73 2 ;
74 2 }
75 1 }
76
77 /*******************LCD寫命令*********************/
78 void LCDWriteCommand(char command)
79 {
80 1 DC = 0;
81 1 RW = 0;
82 1 E = 1;
83 1 CS = 0;
84 1 P0 = command;
85 1 delay(100);
86 1 CS = 1;
87 1 }
88
89 /*******************LCD寫數(shù)據(jù)*********************/
90 void LCDWriteData(char databus)
91 {
92 1 DC = 1;
93 1 RW = 0;
94 1 E = 1;
95 1 CS = 0;
96 1 P0 = databus;
97 1 delay(100);
98 1 CS = 1;
99 1 }
100
101
102 /*******************初始化LCD*********************/
103 void LCDInit()
104 {
105 1 LCDWriteCommand(Display_Off); //Set Display_Off
106 1
107 1 LCDWriteCommand(X_ADRESS); //Set X_ADRESS
108 1 LCDWriteCommand(0x00);
109 1 LCDWriteCommand(0x4F);
110 1
111 1 LCDWriteCommand(Y_ADRESS); //Set Y_ADRESS
112 1 LCDWriteCommand(0x00);
113 1 LCDWriteCommand(0x3F);
114 1
115 1 LCDWriteCommand(Contrast); //Set Contrast Control Register
116 1 LCDWriteCommand(0x40);
117 1
C51 COMPILER V7.50 MAIN 01/03/2006 14:59:51 PAGE 3
118 1 LCDWriteCommand(QuarterCurr); //Quarter Current Range
119 1
120 1 LCDWriteCommand(Re_map); //Set Re-map
121 1 LCDWriteCommand(0x00);
122 1
123 1 LCDWriteCommand(StartLine); //Set Display Start Line
124 1 LCDWriteCommand(0x00);
125 1
126 1 LCDWriteCommand(DispOffset); //Set Display Start Line
127 1 LCDWriteCommand(0x00);
128 1
129 1 LCDWriteCommand(NormDisp); //Display Mode
130 1
131 1 LCDWriteCommand(MultiRadio); //Set Multiplex Ratio
132 1 LCDWriteCommand(0x4F);
133 1
134 1 LCDWriteCommand(MasterConfig); //Set Master Configuration
135 1 LCDWriteCommand(0x03);
136 1
137 1 LCDWriteCommand(EnCompensate); //Set Pre-charge Compensation Enable
138 1 LCDWriteCommand(0x08);
139 1
140 1 LCDWriteCommand(LvCompensate); //Set Pre-charge Compensation Level
141 1 LCDWriteCommand(0x00);
142 1
143 1 LCDWriteCommand(SegmentLow); //Set Segment Low Voltage(VSL)
144 1 LCDWriteCommand(0x0E);
145 1
146 1 LCDWriteCommand(VCOMH); //Set VCOMH Voltage
147 1 LCDWriteCommand(0x11);
148 1
149 1 LCDWriteCommand(Precharge); //Set Precharge Voltage
150 1 LCDWriteCommand(0x18);
151 1
152 1 LCDWriteCommand(PhaseLength); //Set Phase Length
153 1 LCDWriteCommand(0x03);
154 1 LCDWriteCommand(0x50);
155 1
156 1 LCDWriteCommand(RowPeriod); //Set Row Period
157 1 LCDWriteCommand(0x25);
158 1
159 1 LCDWriteCommand(DispClock); //Set Display Clock Divide Ratio/Oscillator Frequency
160 1 LCDWriteCommand(0x02);
161 1 LCDWriteCommand(0x00);
162 1
163 1 //LCDWriteCommand(GrayScale); //Set Gray Scale Table
164 1
165 1 LCDWriteCommand(BiasCurr); //Set Biasing Current for DC-DC converter
166 1 LCDWriteCommand(0xF0);
167 1 }
168
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 221 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILER V7.50 MAIN 01/03/2006 14:59:51 PAGE 4
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -