1
//==============================================================
2
//12232.h
3
//==============================================================
4
#ifndef __12232Driver_H
5
#define __12232Driver_H
6
void LCD_Init(void);
7
void LCD_Reset(void);
8
void LCD_FillAll(void);
9
void LCD_ClearAll(void);
10
void LCD_WriteCmd(unsigned char cmd);
11
void LCD_WriteCmd1(unsigned char cmd);
12
void LCD_WriteCmd2(unsigned char cmd);
13
void LCD_SetColumn(unsigned char column);
14
void LCD_SetColumn1(unsigned char column);
15
void LCD_SetColumn2(unsigned char column);
16
void LCD_SetPage(unsigned char page);
17
void LCD_SetPage1(unsigned char page);
18
void LCD_SetPage2(unsigned char page);
19
void LCD_WriteData(unsigned char d);
20
void LCD_WriteData1(unsigned char d);
21
void LCD_WriteData2(unsigned char d);
22
unsigned char LCD_ReadData1(void);
23
unsigned char LCD_ReadData2(void);
24
#endif
25
26
//==============================================================
27
//12232Driver.c
28
//==============================================================
29
#include <reg51.h>
30
#include "12232Driver.h"
31
//#include <intrins.h>
32
33
sbit E1=P3^4;
34
sbit E2=P3^5;
35
sbit A0=P3^7;
36
sbit RST=P3^2;
37
sbit RW=P3^6;
38
39
#define LCD_DISPLAY_ON 0xAF
40
#define LCD_DISPLAY_OFF 0xAE
41
#define LCD_START_LINE_0 0xC0 //Set Start Line 0
42
#define LCD_DRIVER_NORMAL 0xA4 //Normal display operation
43
#define LCD_DRIVER_STATIC 0xA5 //Power Save
44
#define LCD_DUTY_32 0xA9
45
#define LCD_DUTY_16 0xA8
46
#define LCD_RIGHTWARD_OUTPUT 0xA0
47
#define LCD_LEFTWARD_OUTPUT 0xA1
48
#define LCD_RESET 0xE3
49
#define LCD_PAGE_0 0xB8
50
#define LCD_RMW 0xE0
51
#define LCD_END 0xEE
52
#define uchar unsigned char
53
//LCD Controller Display and Control Functions
54
55
void LCD_Init(void)
56
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56