📄 hdc1600.lst
字号:
C51 COMPILER V7.09 HDC1600 08/24/2007 15:55:02 PAGE 1
C51 COMPILER V7.09, COMPILATION OF MODULE HDC1600
OBJECT MODULE PLACED IN hdc1600.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE hdc1600.c OPTIMIZE(SIZE) BROWSE DEBUG OBJECTEXTEND
line level source
1 /*
2 *************************************************************************************************
3 * CM50012ACT6 65k color Graphical LCD Display Driver (HYVIX HDC1600 controller)
4 * All Rights Reserved
5 * File name : hdc1600.c
6 * Programmer : John Leung, TechToys Co. Hong Kong
7 * Web presence : www.TechToys.com.hk
8 * Note :
9 * Language : Keil C (C51) compiler, Eval version 7.09 under uVision2 IDE v2.40
10 * Hardware : AT89S8253-cLCD-STK1, & CM50010ACT6_BO
11 * Date : 24th August 2007
12 * Version : 1.0
13 *************************************************************************************************
14 * DESCRIPTION
15 *
16 * This module provides an interface to CM50012ACT6 65k color graphical LCD module of 128x160dots
17 * Display controller chip is Hyvix HDC1600
18 * Module requires 3.3V DC supply to Vdd, LED backlight requires 6.2-6.5V, 15mA typical
19 *
20 * LCD pinout function summarized as below
21 * --------- LCD MCU -----------------
22 * pin 1 LED-K - GND (Cathode for LED-backlight)
23 * pin 2 LED+A - LED backlight, requires 6.2-6.5V, 15mA typical
24 * pin 3 Vss - GND
25 * pin 4 Vdd - 3.3V Supply
26 * pin 5 n.c. - shunt to ground
27 * pin 6 n.c.
28 * pin 7 CS - chip select, low active
29 * pin 8 RST - reset, low active; wired to manual reset switch of the whole system
30 * pin 9 A0 - (H:Data, L:Command (data or command control))
31 * pin 10 WR - active low, L:Write; use with RD pin
32 * pin 11 RD - active low, L:Read; use with WR pin
33 * pin 12:19 D7:D0 - LCD_DATA
34 * pin 20 - Vss
35 ***********************************************************************************************
36 */
37
38 #include <REG51RB2.H>
39 #include <delay.h>
40 #include "hdc1600.h"
41 #if PIXEL_FONT_EN
42 #include "sysfont.h"
43 #endif
44
45 /*
46 *********************************************************************************************************
47 * LOCAL DEFINITIONS
48 *********************************************************************************************************
49 */
50
51 #define OUTPUT 0
52 #define INPUT 1
53 #define HIGH 1
54 #define LOW 0
55
C51 COMPILER V7.09 HDC1600 08/24/2007 15:55:02 PAGE 2
56 #define OSCILLATION_MODE_SET 0x02
57 #define DRIVER_OUTPUT_MODE_SET 0x10
58 #define BOOST_COEF_SET 0x22
59 #define DCDC_CLK_FREQ_SET 0x24 //DC-DC Clock division set
60 #define DCDC_AMP_ON_OFF_SET 0x26
61 #define TEMP_COMPENSATION_SET 0x28
62 #define CONTRAST_CONTROL3 0x29
63 #define CONTRAST_CONTROL1 0x2A
64 #define CONTRAST_CONTROL2 0x2B
65 #define STANDBY_MODE_OFF 0x2C
66 #define STANDBY_MODE_ON 0x2D
67 #define DDRAM_BURST_MODE_OFF 0x2E
68 #define DDRAM_BURST_MODE_ON 0x2F
69 #define N_LINE_INVERSION_SET 0x34
70 #define FRAME_FREQUENCY_CONTROL_SET 0x36
71 #define ENTRY_MODE_SET 0x40
72 #define X_ADDRESS_AREA_SET 0x42
73 #define Y_ADDRESS_AREA_SET 0x43
74 #define CURRENT_BIAS_SET 0x46
75 #define DISPLAY_OFF 0x50
76 #define DISPLAY_ON 0x51
77 #define SPEC_DISPLAY_PATTERN_SET 0x53
78 #define PARTIAL_DISPLAY_MODE_SET 0x55
79 #define PARTIAL_DISPLAY_1_START_LINE 0x56
80 #define PARTIAL_DISPLAY_1_END_LINE 0x57
81 #define SCROLL_START_1_MEM_SET 0x5A
82 #define MPE_MODE_OFF 0x5C
83 #define MPE_MODE_ON 0x5D
84 #define PARTIAL_DISPLAY_2_START_LINE 0x60
85 #define PARTIAL_DISPLAY_2_END_LINE 0x62
86 #define SCROLL_START_2_MEM_SET 0x64
87 #define COMMON_SCAN_MODE_SET 0x66
88 #define COMMON_SCAN_MODE_OFF 0x67
89 #define Y_ADDRESS_DEC_SET 0x68
90 #define Y_ADDRESS_DEC_OFF 0x69
91 #define BLANK_TIME_SET 0x6A
92 #define RED_PALETTE_SET 0x70
93 #define GREEN_PALETTE_SET 0x71
94 #define BLUE_PALETTE_SET 0x72
95
96 /*
97 *********************************************************************************************************
98 * LOCAL FUNCTIONS PROTOTYPE
99 *********************************************************************************************************
100 */
101 static void cDispRstArea(void);
102
103
104 /*
105 *********************************************************************************************************
106 * RESET DISPLAY AREA TO 128*160 MATRIX
107 *
108 * Description : This function resets the display area to 128*160 matrix, local function
109 * Arguments : none
110 *
111 * Returns : none
112 * Note : This function is a local function.
113 * Dependency on cDispWrCmd(DRIVER_OUTPUT_MODE_SET) under cDispInit() because
114 * display direction changed on SDIR, and CDR=0 (by hardware).
115 *********************************************************************************************************
116 */
117 static void cDispRstArea(void)
C51 COMPILER V7.09 HDC1600 08/24/2007 15:55:02 PAGE 3
118 {
119 1 cDispWrCmd(X_ADDRESS_AREA_SET); //X-address counter set, offset from 0~159 for 160 dots
120 1 cDispWrCmd(0);
121 1 cDispWrCmd(159);
122 1
123 1 cDispWrCmd(Y_ADDRESS_AREA_SET); //Y-address counter set, offset from 0~127 for 128 dots
124 1 cDispWrCmd(0);
125 1 cDispWrCmd(127);
126 1 }
127
128 /*
129 *********************************************************************************************************
130 * DISPLAY INITIALIZATION
131 *
132 * Description : This function initializes the LCD module
133 * Arguments : none
134 *
135 * Returns : none
136 * Note : This function should be called once before any of the other functions
137 *********************************************************************************************************
138 */
139 void cDispInit(void)
140 {
141 1 //INT8U p;
142 1
143 1 cDispInitPort();
144 1
145 1 cDispWrCmd(STANDBY_MODE_OFF); //Standby mode off
146 1
147 1 cDispWrCmd(DCDC_CLK_FREQ_SET); //DC-DC clock freq. set 12kHz
148 1 cDispWrCmd(0x03);
149 1
150 1 cDispWrCmd(FRAME_FREQUENCY_CONTROL_SET);//Main clock frequency set (90Hz)
151 1 cDispWrCmd(0x12); //1A:1.2+(0.025*1AH) = 1.85MHz
152 1 //Frame rate :1/(128*160*(1/1.85M))=90Hz
153 1 cDispWrCmd(OSCILLATION_MODE_SET); //oscillator mode set
154 1 cDispWrCmd(0x05); //Internal DC-DC clock input
155 1 //internal DCDC osc. ON, internal main clock input, internal osc ON
156 1
157 1 cDispSetQuali(BRIGHTNESS, CONTRAST);
158 1
159 1 cDispWrCmd(CURRENT_BIAS_SET);
160 1 cDispWrCmd(0x07);
161 1
162 1 cDispWrCmd(BOOST_COEF_SET);
163 1 cDispWrCmd(0x06);
164 1
165 1 cDispWrCmd(TEMP_COMPENSATION_SET); //set the temperature compensation ratio
166 1 cDispWrCmd(0x00);
167 1
168 1 cDispWrCmd(DRIVER_OUTPUT_MODE_SET); //SDIR=0(Y-address 00H to 7FH), SWP=0 (normal state, D7-D0 or D15-D0
- written
169 1 cDispWrCmd(0x20); //to the RAM as it is the initial state
170 1
171 1 cDispWrCmd(DDRAM_BURST_MODE_ON); //burst mode ON for data RAM write
172 1
173 1 cDispWrCmd(ENTRY_MODE_SET); //entry mode set, non-reverse, X address count mode, automatic address inc
-rement
174 1 cDispWrCmd(0x00);
175 1
176 1 cDispWrCmd(COMMON_SCAN_MODE_SET);
177 1
C51 COMPILER V7.09 HDC1600 08/24/2007 15:55:02 PAGE 4
178 1 cDispWrCmd(DCDC_AMP_ON_OFF_SET);
179 1 cDispWrCmd(0x0F);
180 1
181 1 cDispRstArea();
182 1
183 1 cDispWrCmd(SPEC_DISPLAY_PATTERN_SET); //normal display
184 1 cDispWrCmd(0x00);
185 1
186 1 cDispWrCmd(PARTIAL_DISPLAY_MODE_SET); //partial display normal disabled
187 1 cDispWrCmd(0x00);
188 1
189 1 cDispWrCmd(MPE_MODE_OFF);
190 1
191 1 cDispWrCmd(Y_ADDRESS_DEC_SET);
192 1 cDispWrCmd(0x00);
193 1
194 1 cDispWrCmd(BLANK_TIME_SET);
195 1 cDispWrCmd(0x00);
196 1 cDispWrCmd(0x00);
197 1
198 1 //For sack of saving program space, palette setting below is not used for Keil C 2k limit
199 1 /*
200 1 // RED
201 1 p = PALETTE_RED;
202 1 cDispWrCmd(RED_PALETTE_SET);
203 1 cDispWrCmd(0);
204 1 cDispWrCmd(10+p);
205 1 cDispWrCmd(18+p);
206 1 cDispWrCmd(24+p);
207 1 cDispWrCmd(28+p);
208 1 cDispWrCmd(32+p);
209 1 cDispWrCmd(35+p);
210 1 cDispWrCmd(38+p);
211 1 cDispWrCmd(41+p);
212 1 cDispWrCmd(44+p);
213 1
214 1 cDispWrCmd(47+p);
215 1 cDispWrCmd(50+p);
216 1 cDispWrCmd(53+p);
217 1 cDispWrCmd(56+p);
218 1 cDispWrCmd(59+p);
219 1 cDispWrCmd(62+p);
220 1 cDispWrCmd(65+p);
221 1 cDispWrCmd(68+p);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -