亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ssd1289.c

?? Display RGB, and an iPOD image on 2.2" TFT color LCD module. IC driver is SSD1289. mcu is Microchip
?? C
字號:
/*
*************************************************************************************************
*	  FG020214 262k color Graphical LCD Display Driver (SOLOMON SYSTEM's SSD1289 controller)
*										All Rights Reserved
* File name		: SSD1289.c
* 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
***********************************************************************************************
*/

#include <p18cxxx.h>					
#include "delay.h"			
#include "SSD1289.h"
#include "sysfont.h"	

/*
*********************************************************************************************************
*											LOCAL DEFINITIONS
*********************************************************************************************************
*/

#define OUTPUT							0
#define INPUT							1
#define HIGH							1
#define LOW								0


/*
*********************************************************************************************************
*                         				DISPLAY INITIALIZATION
*
* Description : This function initializes the LCD module		
* Arguments   : none
*			
* Returns     : none
* Note		  : This function should be called once before any of the other functions
*********************************************************************************************************
*/
void cDispInit(void)
{
	unsigned int i, j;

	cDispInitPort();

	cDispWrCmd(0x00);	//Start Oscillation
	cDispWrDat(0x00);
	cDispWrDat(0x01);

	cDispWrCmd(0x01);	//Driver Output Control
	cDispWrDat(0x23);
	cDispWrDat(0x3F);

	cDispWrCmd(0x02);	//LCD Drive AC Control
	cDispWrDat(0x06);
	cDispWrDat(0x00);

	cDispWrCmd(0x03);	//Power Control (1)
	cDispWrDat(0xA8);
	cDispWrDat(0xA6);

	cDispWrCmd(0x07);	//Display Control
	cDispWrDat(0x00);
	cDispWrDat(0x33);

	cDispWrCmd(0x11);	//Entry Mode (R11h): Set Display color mode for 65k/262k color
	#ifdef _COLOR_24_BIT_ 
	cDispWrDat(0x48);	//DFM1:DFM0=1:0 for 262k color 
	#endif
	#ifdef _COLOR_16_BIT_
	cDispWrDat(0x68);	//DFM1:DFM0=1:1 for 65k color (POR)
	#endif
	cDispWrDat(0x30);
	
	cDispWrCmd(0x0C);	//Power Control (2)
	cDispWrDat(0x00);
	cDispWrDat(0x05);

	cDispWrCmd(0x0D);	//Power Control (3)
	cDispWrDat(0x30);
	cDispWrDat(0x0B);

	cDispWrCmd(0x0E);	//Power Control (4)
	cDispWrDat(0x20);
	cDispWrDat(0x00);

	cDispWrCmd(0x10);	//Exit Sleep Mode
	cDispWrDat(0x00);
	cDispWrDat(0x00);
	DelayMs(30);		//delay 30ms

	cDispWrCmd(0x1E);	//Power Control (5)
	cDispWrDat(0x00);
	cDispWrDat(0xA8);

	cDispWrCmd(0x44);	//Horizontal RAM address position start/end setup
	cDispWrDat(0xEF);	//dec 239
	cDispWrDat(0x00);	//dec 0, i.e. horizontal ranges from 0 -> 239
						//POR value is 0xEF00 anyway. This address must be set before RAM write
	
	cDispWrCmd(0x45);	//Vertical RAM address start position setting
	cDispWrDat(0x00);	//0x0000 = dec 0
	cDispWrDat(0x00);

	cDispWrCmd(0x46);	//Vertical RAM address end position setting
	cDispWrDat(0x01);	//0x013F = dec 319
	cDispWrDat(0x3F);

	cDispWrCmd(0x22);	//RAM write command

	#ifdef _COLOR_24_BIT_
	cDispClr(RGB24(63,63,63));	//initialize the LCD in white color for 24-bit color mode
	#endif

	#ifdef _COLOR_16_BIT_
	cDispClr(RGB16(31,63,31));
	#endif

}

/*
*********************************************************************************************************
*                         	CLEAR DISPLAY BY WRITING PURE COLOR TO THE WHOLE SCREEN
*
* Description : This function writes a 24 bit integer to all pixels making use of the automatic
*				address increment feature for X and Y address counters
*
* Arguments   : 'color' is in 24-bit in form of RGB24(r,g,b)
*				with color defined in red = [xxR5R4R3R2R1R0]
*				in green = [xxG5G4G3G2G1G0]
*				in blue = [xxB5B4B3B2B1B0]; x represents doesn't care bit
*				Therefore (r,g,b) from (0,0,0) to (63,63,63)
*						color=0x000000 eq. black
*						color=0x3F0000 eq. red
*						color=0x003F00 eq. green
*						color=0x00003F eq. blue		
*						color=0x3F3F3F in white		
* Returns     : none
* Remarks	  :
*
*********************************************************************************************************
*/
#ifdef _COLOR_24_BIT_
void cDispClr(INT24U color)
{
	INT8U i,rByte,gByte,bByte;
	INT16U j;

	rByte = color>>16;		//red byte
	gByte = color>>8;		//green byte
	bByte = (INT8U)color;	//blue byte
	
	for(j=0;j<320;j++)
	{
		for(i=0;i<240;i++)
		{
			cDispWrDat(rByte);cDispWrDat(gByte);cDispWrDat(bByte);
		}
	}
}
#endif
	
/*
*********************************************************************************************************
*                         	CLEAR DISPLAY BY WRITING PURE COLOR TO THE WHOLE SCREEN
*
* Description : This function writes a 16 bit integer to all pixels making use of the automatic
*				address increment feature for X and Y address counters
*
* Arguments   : 'color' is in 16-bit in form of RGB16(r,g,b) for 65k color display mode
* 				16-bit color in [R4R3R2R1R0G5G4G3][G2G1G0B4B3B2B1B0]
*				Therefore (r,g,b) from (0,0,0) to (31,63,31)
*						color=0x0000 eq. black
*						color=0xF800 eq. red
*						color=0x07E0 eq. green
*						color=0x001F eq. blue		
*						color=0xFFFF in white		
* Returns     : none
* Remarks	  :
*
*********************************************************************************************************
*/
#ifdef _COLOR_16_BIT_
void cDispClr(INT16U color)
{
	INT8U i,hiByte,lowByte;
	INT16U j;

	hiByte  = color>>8;
	lowByte = (INT8U)color;

	for(j=0;j<320;j++)
	{
		for(i=0;i<240;i++)
		{
			cDispWrDat(hiByte);cDispWrDat(lowByte);
		}
	}
	
}
#endif


/*
*********************************************************************************************************
*                         				SET PIXEL AT x, y POSITION
*
* Description : This function sets a pixel with (INT16U)color at a position defined by (x,y) following 
*				Cartesian coordinate system. Coordinates (0,0) at the top left corner, 
*				coordinates (239,319) at the lower right corner of the LCD screen, w/ module viewed from
*				frontal up direction on FG020214_BO
*
* Arguments   : 'x'    		0....239 is the matrix position in x-axis (left ->right)
*				'y'    		0....319 is the matrix position in y-axis (up -> down)
*				'color'  	sets 16-bit color
* Returns     : none
* Notes		  :
*********************************************************************************************************
*/
#ifdef _COLOR_16_BIT_
void cDispSetPixel(INT8U x, INT16U y, INT16U color)
{
	INT8U hiByte, lowByte;

	cDispWrCmd(0x4E);		//set address in the 240 pixel direction
	cDispWrDat(0x00);		//hiByte first fill all zero
	cDispWrDat(x);			//0<x<239

	hiByte 	= y>>8;
	lowByte = (INT8U)y;

	cDispWrCmd(0x4F);		//set address in the 320 pixel direction
	cDispWrDat(hiByte);
	cDispWrDat(lowByte);
	
	hiByte  = color>>8;
	lowByte = (INT8U)color;

	cDispWrCmd(0x22);		//RAM write command
	cDispWrDat(hiByte);		//write color content here
	cDispWrDat(lowByte);	
}
#endif


/*
*********************************************************************************************************
*               		CONVERT A STRING FROM ROM TO PIXEL DATA AND DISPLAY AT x,y
*
* Description : This function outputs a string in graphic mode (pixel-by-pixel) at a position defined 
*				by (x,y) following Cartesian coordinate system with variable font spacing defined by 
*				fontSpace. Character wrapping is allowed. String from ROM so const rom keyword used
*				*** REQUIRE AT LEAST ONE FONT SET (sysfont.h) included under this file ****
*				Cartesian coordinates as (0,0) at the top left hand corner, (239,319) at the 
*				lower right hand corner, as seen from frontal up view of FG020214_BO
*
* Arguments   : 'x'    		0....239 is matrix position in horizontal direction (x-axis).
*							
*				'y'    		0....319 is matrix position in vertical direction (y-axis).
*
*				'*pStr'		pointer to an ASCII string in ROM (flash), null terminated
*				'fontSpace' font spacing from 1 to 127
*				'color'		16-bit color possible
* Returns     : none
* Notes		  : Microchip C18 complier dependent as const rom keyword involved.
* Example 	  : ....
*				....
*				main()
*				{ 
*					cDispPixStrAt(0,20,"Hello!",1,RGB(31,0,0)); 	//Display the ASCII string "Hello!"
*																	//at (x,y)=(0,20), font space = 1
*																	//color in red
*				}
*********************************************************************************************************
*/
#ifdef _COLOR_16_BIT_
void cDisprStrAt(INT8U x, INT16U y, const rom char *pStr, INT8U fontSpace, INT16U color)
{
	INT8U pixelByte,bit_idx, i;				//loop counters 
	INT8U c,fwidth, fheight;				//character, font width & height store

	while (*pStr)
	{
		c = *pStr++ - 32;
				
		fwidth = SYS_FNT[c].fontWidth;
		fheight = 8;

		if((x+fwidth)>240) 		//character wrapping here				
		{
			x=0;
			y+=fheight;
		}

		if((y+fheight)>320)		//check for y boundary				
		{
			y=0;
		}

		for(i=0;i<fheight;i++)
		{
			pixelByte = SYS_FNT[c].fontBody[i];
			for(bit_idx=0; bit_idx<fwidth; bit_idx++)
				{
						if((pixelByte)&(0x80>>bit_idx))
							cDispSetPixel(x+bit_idx, y+i, color);
				}
		}
		
		x = x+fwidth+fontSpace;
	}	
}
#endif

/*
*********************************************************************************************************
*                         				WRITE A PATTERN AT X, Y COORDINATES
*
* Description : This function writes a particular pattern of size patWidth and patHeight at a position 
*				defined by (x,y) following Cartesian coordinate system. 
*				Pattern defined in ROM (flash)
*				Cartesian coordinates as (0,0) at the top left hand corner, (239,319) at the 
*				lower right hand corner, as seen from frontal up view of FG020214_BO
* Arguments   : 'x'    		0....239 is matrix position in horizontal direction (x-axis)
*				'y'    		0....319 is matrix position in vertical direction (y-axis)
*				'*pPat'		pointer to pattern structure in const rom (FLASH)
*				'color'  	color in 16-bit mode
* Returns     :	none
* Notes		  : Microchip C18 complier dependent as const rom keyword involved
*********************************************************************************************************
*/
#ifdef _COLOR_16_BIT_
void cDisprPatAt(INT8U x, INT16U y, const rom INT16U *pPat)
{
 	INT16U   col, row, pWidth, pHeight, pixel;

	pWidth  = pPat[0];
	pHeight = pPat[1];

	for(row=0;row<pHeight;row++)
		{	
			for(col=0;col<pWidth;col++)
			{
				pixel = pPat[col+row*pWidth+2];
				cDispSetPixel(col+x,row+y,pixel);
			}
		}
}
#endif

/*
*********************************************************************************************************
*                         			LOW LEVEL PORT INITIALIZATION
*
* Description : This function performs low level port initialization
* Arguments   : none
* Returns     : none
* Notes		  : Hardware specific
*********************************************************************************************************
*/
void cDispInitPort(void)
{	
	cDISP_CS		= HIGH;			//de-select the color LCD to start with
	cDISP_CD		= HIGH;
	cDISP_WR		= HIGH;
	cDISP_RD		= HIGH;
	cDISP_DATA		= 0x00;

	TRIS_cDISP_CS 	= OUTPUT;
	TRIS_cDISP_CD	= OUTPUT;
	TRIS_cDISP_WR	= OUTPUT;
	TRIS_cDISP_RD	= OUTPUT;
	TRIS_cDISP_DATA	= OUTPUT;
}

/*
*********************************************************************************************************
*                         				LOW LEVEL COMMAND WRITE TO LCD
*
* Description : This function performs low level command write to LCD
* Arguments   : (INT8U) 'cmd' 	is the command written to the LCD module
* Returns     : none
* Notes		  : Hardware specific.
*********************************************************************************************************
*/
void cDispWrCmd(INT8U cmd)
{
	cDISP_DATA 	= cmd;
	cDISP_CD 	= LOW;			//CD LOW for command		
	cDISP_WR 	= LOW;
	cDISP_RD	= HIGH;
	cDISP_CS 	= LOW;														
	cDISP_CS 	= HIGH;
}
/*
*********************************************************************************************************
*                         				LOW LEVEL DATA WRITE TO LCD
*
* Description : This function performs low level display data write to LCD
* Arguments   : (INT8U) 'dat' 	is the data written to the LCD module
* Returns     : none
* Notes		  : Hardware specific.
*********************************************************************************************************
*/
void cDispWrDat(INT8U dat)
{
	cDISP_DATA 	= dat;
	cDISP_CD 	= HIGH;		//CD HIGH for display data
	cDISP_WR 	= LOW;
	cDISP_RD 	= HIGH;	
	cDISP_CS 	= LOW;											
	cDISP_CS 	= HIGH;
}



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产中文字幕在线视频综合| 成人激情文学综合网| 国产精品一区久久久久| 色94色欧美sute亚洲线路一ni | 欧美日韩国产美女| 2022国产精品视频| 视频一区视频二区中文| a亚洲天堂av| 久久一区二区三区四区| 亚洲大型综合色站| 91蜜桃网址入口| 国产欧美一区二区三区沐欲| 天天做天天摸天天爽国产一区| 成人在线视频一区二区| 日韩亚洲欧美一区| 亚洲mv在线观看| 99国产精品一区| 国产欧美日韩视频在线观看| 水蜜桃久久夜色精品一区的特点| 91视频com| 亚洲国产精品黑人久久久| 老司机午夜精品99久久| 在线播放中文一区| 亚洲欧美另类小说视频| 91丨九色丨国产丨porny| 国产欧美综合在线| 国产精品一区二区黑丝| 精品成人一区二区三区| 久久99精品国产麻豆婷婷| 欧美年轻男男videosbes| 一区二区三区在线观看欧美| 97久久久精品综合88久久| 国产亚洲综合在线| 福利一区福利二区| 欧美激情资源网| 国产成人在线色| 中文av一区二区| av高清久久久| 亚洲区小说区图片区qvod| 97se亚洲国产综合在线| 亚洲欧洲av在线| 色婷婷激情综合| 亚洲综合小说图片| 欧美日韩国产欧美日美国产精品| 亚洲电影欧美电影有声小说| 欧美精品123区| 久草中文综合在线| 久久精品欧美一区二区三区不卡| 国产高清在线观看免费不卡| 国产精品天美传媒| 在线这里只有精品| 五月天视频一区| 欧美成人高清电影在线| 国产专区综合网| 18欧美亚洲精品| 欧美在线视频全部完| 午夜影院久久久| 欧美成人bangbros| 色视频一区二区| 亚洲精品日韩一| 欧美日韩久久一区二区| 极品尤物av久久免费看| 国产精品激情偷乱一区二区∴| 欧美在线|欧美| 久久国产精品无码网站| 国产精品欧美经典| 欧美一区二区三区婷婷月色| 国产成人av影院| 一区二区高清在线| 日韩欧美国产综合一区 | 欧美高清激情brazzers| 裸体一区二区三区| 国产精品国产三级国产专播品爱网| 欧美主播一区二区三区美女| 奇米亚洲午夜久久精品| 亚洲欧洲日产国码二区| 日韩视频一区二区三区在线播放| 国产成人丝袜美腿| 午夜视频在线观看一区二区三区 | 久久成人18免费观看| 中文字幕制服丝袜成人av | 精品亚洲免费视频| 成人免费小视频| 亚洲精品在线免费观看视频| 色哟哟国产精品| 国产精品18久久久久久久久久久久 | 日韩免费高清电影| 蜜乳av一区二区| 日韩欧美成人激情| 色综合久久99| 看片网站欧美日韩| 一区二区三区四区乱视频| 久久综合精品国产一区二区三区| 色偷偷一区二区三区| 国产精品18久久久久久久久| 秋霞成人午夜伦在线观看| 17c精品麻豆一区二区免费| 日韩一区国产二区欧美三区| 色女孩综合影院| 国产一区二区不卡在线| 色综合久久久久久久| 国产一区免费电影| 美女一区二区三区| 丝袜亚洲另类欧美综合| 又紧又大又爽精品一区二区| 国产精品无人区| 欧美精品一区二区久久婷婷| 欧美肥大bbwbbw高潮| 日本丰满少妇一区二区三区| zzijzzij亚洲日本少妇熟睡| 国产乱码一区二区三区| 久久99精品国产91久久来源| 美国欧美日韩国产在线播放| 日韩中文字幕亚洲一区二区va在线| 亚洲欧美一区二区三区孕妇| 欧美国产成人精品| 中文字幕免费观看一区| 久久精品视频在线看| 久久久久99精品一区| 久久免费美女视频| 欧美国产日韩精品免费观看| 26uuu精品一区二区| 久久综合九色欧美综合狠狠| 亚洲精品一区在线观看| 久久亚洲二区三区| 精品久久五月天| 国产三级久久久| 国产精品超碰97尤物18| 洋洋成人永久网站入口| 一个色妞综合视频在线观看| 亚洲18影院在线观看| 日本aⅴ免费视频一区二区三区 | 免费日韩伦理电影| 狠狠色综合日日| 成人a级免费电影| 在线观看网站黄不卡| 在线观看亚洲精品视频| 51精品秘密在线观看| 日韩精品一区二区三区三区免费| 欧美成人aa大片| 国产欧美一区二区在线| 亚洲欧美色综合| 日韩影院精彩在线| 国产在线一区观看| 色综合久久综合| 91.麻豆视频| 中文在线资源观看网站视频免费不卡 | 麻豆精品一区二区三区| 国产夫妻精品视频| 色噜噜狠狠成人中文综合| 欧美日韩成人一区| 欧美精品一区二区不卡 | 日韩美女啊v在线免费观看| 一区二区三区在线免费播放 | 国内精品写真在线观看| 成人激情午夜影院| 欧美日韩国产高清一区| 国产亚洲综合在线| 亚洲午夜激情网站| 国产精品一品二品| 欧美日韩情趣电影| 国产欧美日本一区视频| 亚洲一区二区三区四区在线| 韩国毛片一区二区三区| 欧美日韩一卡二卡三卡| 国产欧美中文在线| 蜜乳av一区二区| 欧美自拍偷拍午夜视频| 国产精品天天摸av网| 人人超碰91尤物精品国产| 91麻豆.com| 国产午夜精品一区二区三区视频| 午夜精品一区二区三区免费视频| 成人一二三区视频| 欧美大黄免费观看| 亚洲一区二区3| 99精品1区2区| 亚洲国产高清aⅴ视频| 麻豆极品一区二区三区| 欧美美女视频在线观看| 综合激情成人伊人| 国产91清纯白嫩初高中在线观看| 日韩一区二区视频在线观看| 亚洲午夜精品网| 色婷婷久久一区二区三区麻豆| 国产精品视频免费| 国产精品一卡二| 精品国产一区二区三区不卡| 视频一区二区三区在线| 91精品办公室少妇高潮对白| 国产精品大尺度| 99免费精品视频| 中文字幕av不卡| av色综合久久天堂av综合| 欧美国产综合一区二区| 国产精品77777| 国产欧美综合在线| 成人动漫中文字幕| 中文字幕乱码亚洲精品一区| 国产福利电影一区二区三区|