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

📄 ssd1289.h

📁 Display RGB, and an iPOD image on 2.2" TFT color LCD module. IC driver is SSD1289. mcu is Microchip
💻 H
字号:
/*
*************************************************************************************************
*	  FG020214 262k color Graphical LCD Display Driver (SOLOMON SYSTEM's SSD1289 controller)
*										All Rights Reserved
* File name		: SSD1289.h
* Programmer 	: John Leung, TechToys Co. Hong Kong
* Web presence  : www.TechToys.com.hk
* Note			: 
* Language		: C18 complier version 2.40, MPLAB v7.41
* Hardware		: PIC18LF4550-STK1 connected to a prototype board for FG020214 via strip wires
* Date			: 16 Nov 2006		Version 1.0a
*************************************************************************************************
*										DESCRIPTION
*
* This module provides an interface to FG020214 262k color graphical LCD module of 240*320dots
* Display controller chip is SSD1289
* Module requires 3.3V DC supply to Vdd, LED backlight requires 15mA typical
* Backlight driven by CAT32 for 15mA constant current driver
* <PS3:PS1:PS0> in <1:0:0> for 8-bit data bus mode 8080
*
* LCD pinout function on PCB (FG020214_BO) summarized as below 
* --------- LCD		MCU -----------------
* pin 2		SHDN_BL - NOT used here, short to VCC via 100k resistor
* pin 4 	GND 	- GND
* pin 6		VCC  	- 3.3V supply
* pin 8		n.c.	- n.c.
* pin 10	WR		- RE1
* pin 12	RD		- RE0
* pin 14	CS		- RE2
* pin 16	CD		- RA5
* pin 18	RST		- To system reset
* pin 20:34	D0:D7	- LCD_DATA connected to RD0:RD7
* pin 36	SHUT	- n.c.
* pin 38	n.c.
* pin 40	n.c.
*
* Remarks: Pins at the odd number side is not used for 8-bit mode. 
*
***********************************************************************************************
*/


/*
***********************************************************************************************
* Date			: 10th May 2007
* Modification	: cDispClr(RGB24(r,g,b)) added
* 				  Project compiled with C18 version 2.40 & MPLAB version upgraded to V7.60
* Version		: v1.0b
***********************************************************************************************
*/

/*
***********************************************************************************************
* Date			: 13th JUNE 2007
* Modification	: 16 bit color mode for string print and pattern print added
* 				  Project compiled with C18 version 2.40 & MPLAB version upgraded to V7.60
* Version		: v1.0c
***********************************************************************************************
*/

#ifndef _SSD1289_H_
#define _SSD1289_H_

#define _COLOR_16_BIT_
//#define _COLOR_24_BIT_

typedef unsigned char 		INT8U;
typedef unsigned int		INT16U;
typedef unsigned short long INT24U;
typedef unsigned char		BOOLEAN;


/*
***********************************************************************************************
* Pack RGB in 24 bits, for 262k color display mode
* [xxR5R4R3R2R1R0][xxG5G4G3G2G1G0][xxB5B4B3B2B1B0]
* 'x' stands for doesn't care bit. A left shift with red byte for 18 bits position, 
* and left shift for 10 bits position for green bit is to compensate for the data format required 
* in 24-bit mode as a data write to LCD in [R5R4R3R2R1R0xx]... required.
***********************************************************************************************
*/
#define RGB24(r,g,b)	((INT24U)r<<18)+((INT16U)g<<10)+((INT8U)b<<2)

/*
***********************************************************************************************
* Pack RGB in 16 bits, for 65k color display mode
* [R4R3R2R1R0G5G4G3][G2G1G0B4B3B2B1B0]
***********************************************************************************************
*/
#define RGB16(r,g,b)	((INT16U)r<<11)+((INT16U)g<<5)+(INT8U)b

/*
***********************************************************************************************
* Define a system font here
***********************************************************************************************
*/
#define MAX_FONT_WIDTH 	8
typedef struct _font
	{
		INT8U fontWidth;
		INT8U fontBody[MAX_FONT_WIDTH];
	}font;

/*
***********************************************************************************************
*								Pin definition, C18 specific
*								Hardware: PIC18LF4550-STK1
***********************************************************************************************
*/

#define TRIS_cDISP_RD	TRISEbits.TRISE0	//RD pin connect to RE0
#define cDISP_RD		LATEbits.LATE0
#define TRIS_cDISP_WR	TRISEbits.TRISE1	//WR pin connect to RE1
#define cDISP_WR		LATEbits.LATE1
#define TRIS_cDISP_CS	TRISEbits.TRISE2	//CS pin connect to RE2
#define cDISP_CS		LATEbits.LATE2	
#define TRIS_cDISP_CD	TRISAbits.TRISA5	//CD pin, control command/data, connected to RA5
#define cDISP_CD		LATAbits.LATA5	


#define TRIS_cDISP_DATA TRISD				//LCD 8-bit data port to PORTD	
#define cDISP_DATA		LATD
#define cDISP_PORT		PORTD

/*
***********************************************************************************************
*										GLOBAL CONSTANTS
***********************************************************************************************
*/

#define ENABLE				1
#define DISABLE				0

/*
***********************************************************************************************
*									FUNCTION PROTOTYPES
***********************************************************************************************
*/

/*
***********************************************************************************************
*									FUNCTION PROTOTYPES
*									 HARDWARE SPECIFIC
***********************************************************************************************
*/
void cDispInit(void);
#ifdef _COLOR_24_BIT_
void cDispClr(INT24U color);
#endif
#ifdef _COLOR_16_BIT_
void cDispClr(INT16U color);
void cDispSetPixel(INT8U x, INT16U y, INT16U color);
void cDisprPatAt(INT8U x, INT16U y, const rom INT16U *pPat);
void cDisprStrAt(INT8U x, INT16U y, const rom char *pStr, INT8U fontSpace, INT16U color);
void cDispStrAt(INT8U x, INT16U y, char *pStr, INT8U fontSpace, INT16U color);
#endif
void cDispInitPort(void);
void cDispWrCmd(INT8U cmd);
void cDispWrDat(INT8U dat);
#endif

⌨️ 快捷键说明

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