⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 so12864.h

📁 采用Mega128控制LCD12864液晶显示器
💻 H
字号:
/* ==========================================================================*/
/* - - - - - - - - - - - - -  so12864.h  - - - - - - - - - - - - - - - - - - */
/* ==========================================================================*/
/*	Created   01-13-2008   Jayhan                                            */
/*.........................................................................  */
/*  so12864's module include file                                            */
/*.........................................................................  */
#ifndef SO12864_H
#define SO12864_H

#include "compiler.h"

#define	LCD_AO_TRIS		0x00
#define LCD_RST_TRIS	0x01
#define LCD_CS_TRIS		0x02

#define	LCD_AO_IO		PORTD
#define LCD_RST_IO		PORTD
#define LCD_CS_IO		PORTD

#define LCD_AO_PIN		0x00
#define LCD_RST_PIN		0x01
#define LCD_CS_PIN		0x02

#define DDR_SPI			DDRB 
#define DDR_SPI_CTL		DDRD
#define DD_MOSI			2
#define DD_SCK			1 

#define BIT(x) (1 << (x)) 

/* display on/off */
#define DISPLAY_ON		0xAF
#define DISPLAY_OFF		0xAE

/* Display Start line Set */
#define START_LINE_0	0x40
#define START_LINE_1	0x41
#define START_LINE_2	0x42
#define START_LINE_3	0x43
#define START_LINE_4	0x44
#define START_LINE_5	0x45
#define START_LINE_6	0x46
#define START_LINE_7	0x47
#define START_LINE_8	0x48
#define START_LINE_9	0x49
#define START_LINE_10	0x4A
#define START_LINE_11	0x4B
#define START_LINE_12	0x4C
#define START_LINE_13	0x4D
#define START_LINE_14	0x4E
#define START_LINE_15	0x4F
#define START_LINE_16	0x50
#define START_LINE_17	0x51
#define START_LINE_18	0x52
#define START_LINE_19	0x53
#define START_LINE_20	0x54
#define START_LINE_21	0x55
#define START_LINE_22	0x56
#define START_LINE_23	0x57
#define START_LINE_24	0x58
#define START_LINE_25	0x59
#define START_LINE_26	0x5A
#define START_LINE_27	0x5B
#define START_LINE_28	0x5C
#define START_LINE_29	0x5D
#define START_LINE_30	0x5E
#define START_LINE_31	0x5F
#define START_LINE_32	0x60
#define START_LINE_33	0x61
#define START_LINE_34	0x62
#define START_LINE_35	0x63
#define START_LINE_36	0x64
#define START_LINE_37	0x65
#define START_LINE_38	0x66
#define START_LINE_39	0x67
#define START_LINE_40	0x68
#define START_LINE_41	0x69
#define START_LINE_42	0x6A
#define START_LINE_43	0x6B
#define START_LINE_44	0x6C
#define START_LINE_45	0x6D
#define START_LINE_46	0x6E
#define START_LINE_47	0x6F
#define START_LINE_48	0x70
#define START_LINE_49	0x71
#define START_LINE_50	0x72
#define START_LINE_51	0x73
#define START_LINE_52	0x74
#define START_LINE_53	0x75
#define START_LINE_54	0x76
#define START_LINE_55	0x77
#define START_LINE_56	0x78
#define START_LINE_57	0x79
#define START_LINE_58	0x7A
#define START_LINE_59	0x7B
#define START_LINE_60	0x7C
#define START_LINE_61	0x7D
#define START_LINE_62	0x7E
#define START_LINE_63	0x7F

/* Page Address Set */
#define PAGE_0			0xB0
#define PAGE_1			0xB1
#define PAGE_2			0xB2
#define PAGE_3			0xB3
#define PAGE_4			0xB4
#define PAGE_5			0xB5
#define PAGE_6			0xB6
#define PAGE_7			0xB7
#define PAGE_8			0xB8

/* Column Address Set */
#define COLUMN_0		0x1000
#define COLUMN_1		0x1001
#define COLUMN_2		0x1002
#define COLUMN_3		0x1003
#define COLUMN_4		0x1004
#define COLUMN_5		0x1005
#define COLUMN_6		0x1006
#define COLUMN_7		0x1007
#define COLUMN_8		0x1008
#define COLUMN_9		0x1009
#define COLUMN_10		0x100A
#define COLUMN_11		0x100B
#define COLUMN_12		0x100C
#define COLUMN_13		0x100D
#define COLUMN_14		0x100E
#define COLUMN_15		0x100F
#define COLUMN_16		0x1100
#define COLUMN_17		0x1101
#define COLUMN_18		0x1102
#define COLUMN_19		0x1103
#define COLUMN_20		0x1104
#define COLUMN_21		0x1105
#define COLUMN_22		0x1106
#define COLUMN_23		0x1107
#define COLUMN_24		0x1108
#define COLUMN_25		0x1109
#define COLUMN_26		0x110A
#define COLUMN_27		0x110B
#define COLUMN_28		0x110C
#define COLUMN_29		0x110D
#define COLUMN_30		0x110E
#define COLUMN_31		0x110F
#define COLUMN_32		0x1200
#define COLUMN_33		0x1201
#define COLUMN_34		0x1202
#define COLUMN_35		0x1203
#define COLUMN_36		0x1204
#define COLUMN_37		0x1205
#define COLUMN_38		0x1206
#define COLUMN_39		0x1207
#define COLUMN_40		0x1208
#define COLUMN_41		0x1209
#define COLUMN_42		0x120A
#define COLUMN_43		0x120B
#define COLUMN_44		0x120C
#define COLUMN_45		0x120D
#define COLUMN_46		0x120E
#define COLUMN_47		0x120F
#define COLUMN_48		0x1300
#define COLUMN_49		0x1301
#define COLUMN_50		0x1302
#define COLUMN_51		0x1303
#define COLUMN_52		0x1304
#define COLUMN_53		0x1305
#define COLUMN_54		0x1306
#define COLUMN_55		0x1307
#define COLUMN_56		0x1308
#define COLUMN_57		0x1309
#define COLUMN_58		0x130A
#define COLUMN_59		0x130B
#define COLUMN_60		0x130C
#define COLUMN_61		0x130D
#define COLUMN_62		0x130E
#define COLUMN_63		0x130F
#define COLUMN_64		0x1400
#define COLUMN_65		0x1401
#define COLUMN_66		0x1402
#define COLUMN_67		0x1403
#define COLUMN_68		0x1404
#define COLUMN_69		0x1405
#define COLUMN_70		0x1406
#define COLUMN_71		0x1407
#define COLUMN_72		0x1408
#define COLUMN_73		0x1409
#define COLUMN_74		0x140A
#define COLUMN_75		0x140B
#define COLUMN_76		0x140C
#define COLUMN_77		0x140D
#define COLUMN_78		0x140E
#define COLUMN_79		0x140F
#define COLUMN_80		0x1500
#define COLUMN_81		0x1501
#define COLUMN_82		0x1502
#define COLUMN_83		0x1503
#define COLUMN_84		0x1504
#define COLUMN_85		0x1505
#define COLUMN_86		0x1506
#define COLUMN_87		0x1507
#define COLUMN_88		0x1508
#define COLUMN_89		0x1509
#define COLUMN_90		0x150A
#define COLUMN_91		0x150B
#define COLUMN_92		0x150C
#define COLUMN_93		0x150D
#define COLUMN_94		0x150E
#define COLUMN_95		0x150F
#define COLUMN_96		0x1600
#define COLUMN_97		0x1601
#define COLUMN_98		0x1602
#define COLUMN_99		0x1603
#define COLUMN_100		0x1604
#define COLUMN_101		0x1605
#define COLUMN_102		0x1606
#define COLUMN_103		0x1607
#define COLUMN_104		0x1608
#define COLUMN_105		0x1609
#define COLUMN_106		0x160A
#define COLUMN_107		0x160B
#define COLUMN_108		0x160C
#define COLUMN_109		0x160D
#define COLUMN_110		0x160E
#define COLUMN_111		0x160F
#define COLUMN_112		0x1700
#define COLUMN_113		0x1701
#define COLUMN_114		0x1702
#define COLUMN_115		0x1703
#define COLUMN_116		0x1704
#define COLUMN_117		0x1705
#define COLUMN_118		0x1706
#define COLUMN_119		0x1707
#define COLUMN_120		0x1708
#define COLUMN_121		0x1709
#define COLUMN_122		0x170A
#define COLUMN_123		0x170B
#define COLUMN_124		0x170C
#define COLUMN_125		0x170D
#define COLUMN_126		0x170E
#define COLUMN_127		0x170F
#define COLUMN_128		0x1800
#define COLUMN_129		0x1801
#define COLUMN_130		0x1802
#define COLUMN_131		0x1803

/* ADC Select (Segment Driver Direction Select) */
#define ADC_NORMAL		0xA0
#define ADC_REVERSE		0xA1

/* Display Normal/Reverse */
#define DISPLAY_NORMAL	0xA6
#define DISPLAY_REVERSE 0xA7

/* Display All Points ON/OFF */
#define ALL_POINT_NORMAL	0xA4
#define ALL_POINT_ON		0xA5

/* LCD Bias Set */
#define BIAS_1_9		0xA2
#define BISA_1_7		0xA3

/* Read/Modify/Write */
#define RD_MD_WR		0xE0

/* END */
#define END				0xEE

/* RESET */
#define RESET			0xE2

/* Common Output Mode Select */
#define OUTPUT_MODE_NORMAL	0xC0
#define OUTPUT_MPDE_REVERSE 0xC8

/* Power Controller Set */
#define POWER				0x2F

/* V0 Voltage Regulator Internal Resistor Ration Set */
#define RESISTOR_RATION		0x24

/* The Electronic Volume (Double Byte Command) */
#define ELECTRONIC_VOLUME	0x8124

/* Static Indicator(Double Byte Command) */
#define STATIC_INDICATOR	0xAC00

/* The Booster Ratio (Double Byte Command) */
#define BOOSTER_RATION		0xF800

/************************************************************************/
/*                           Function  Declaration                      */
/************************************************************************/
void Init_LCD(void);
void Clear_LCD(void);
void Write_LCDCOM(BYTE command);
void Write_LCDDATA(BYTE data);
void DispEN_LCD(BYTE page, WORD column, BYTE *ptr);
void DispCN_LCD(BYTE page, WORD column, BYTE *ptr);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -