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

📄 ks0108.h

📁 reading gps data from serial
💻 H
字号:
/*
***********************************************************************************************
*					JHD12864G/J Graphical LCD Display Driver (KS0107/8 controller)
*
* File name		: ks0108.c
* Programmer 	: RAULL
* Web presence  : 
* Note			: 
* Language		: Keil C 7.09 2K limited version in uVision2 IDE version 2.40
* Hardware		: PIC18F450 demo board
* Date			: Version 1.0 (4th May 2008) - (4th July 2006)
***********************************************************************************************
*										DESCRIPTION
*
* This module provides an interface to JHD12864J Graphical LCD module of size 128x64 dots
* Display controller chip is KS0107/8
* LCD pinout function summarized as below
* --------- LCD		MCU -----------------
* pin 1		Vss 	- 0V
* pin 2 	Vdd 	- 5.0V
* pin 3		Vo  	- LCD Drive Voltage (adjust contrast, trimmer to Vee in our case)
* pin 4		D/I		- LCD_DI (H:Data, L:Command (data or command control))
* pin 5		R/W 	- LCD_RW (H:Read, L:Write (read status or write data/command))
* pin 6		E   	- LCD_EN (H/H->L (IC Select or chip enable, H->L effective))
* pin 7:14	PORTD	- LCD_DATA
* pin 15	CS1		- LCD_CS1 (left, high effective)
* pin 16	CS2		- LCD_CS2 (right, high effective)
* pin 17	RST		- LCD_RST (reset pin, low effective)
* pin 18	Vee		- -10.0V, LCD driving voltage. There is a Vee generator built-in LCD
*					  module, thus there is no need to use external generator IC
* pin 19	EL1 / A - LCD_BL (Depends on the backlight option.
*						If it's a LED backlight, it's an anode.
*					  	If it is EL type, this is EL controller input)
* pin 20	EL2 / K	- GND (Cathode for LED-backlight. EL input (OR NC) for EL-backlight model)
***********************************************************************************************
*/

#ifndef __KS0108_H
#define __KS0108_H
#include "delay.h"
#define PIXEL_FONT_EN 		1
#if 	PIXEL_FONT_EN
#define MAX_FONT_WIDTH 		8
# define FAST_GLCD


#ifdef FAST_GLCD
typedef struct _displayData
{
   unsigned char left[512];
   unsigned char right[512];
} displayData;
#endif

typedef struct _font
	{
	unsigned char fontWidth;
	unsigned char fontBody[MAX_FONT_WIDTH];
	}font;
#endif

#define PIXEL_PAT_EN		0
#if		PIXEL_PAT_EN
#define MAX_PAT_SIZE 		48*8
typedef struct _pattern
	{
	unsigned char patWidth;
	unsigned char patHeight;
	unsigned char patBody[MAX_PAT_SIZE];
	}pattern;
#endif

/*
***********************************************************************************************
*										PORT DEFINITION
***********************************************************************************************
*/

//I/O port for data definition
#define LCD_DATA PORTD

//Control pin setting (Keil C specific for 8051)

//	LCD_BL	=			P2^7;
#define LCD_CS1 PORTBbits.RB0	
#define	LCD_CS2	PORTBbits.RB1
#define LCD_DI	PORTBbits.RB2
#define	LCD_RST	PORTBbits.RB3
#define	LCD_RW	PORTBbits.RB4
#define	LCD_EN  PORTBbits.RB5





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

#define MAX_ROW_PIXEL		64		//MAX_ROW_PIXEL the physical matrix length (y direction)									
#define MAX_COL_PIXEL		128		//MAX_COL_PIXEL the physical matrix width (x direction)
#define ENABLE				1
#define DISABLE				0
#define BLACK				1
#define WHITE				0









/*
***********************************************************************************************
*									FUNCTION PROTOTYPES
***********************************************************************************************
*/
void GDispInit(void);
void GDispSwitch(unsigned char sw);
void GDispWrByte(unsigned char col, unsigned char page, unsigned char *c);
void GDispClr(unsigned char pat);
void GDispSetPixel(unsigned char x, unsigned char y, char color);
#if PIXEL_PAT_EN
void GDispPixPatAt(unsigned char x, unsigned char y, pattern* pPat, unsigned char color);
#endif
#if PIXEL_FONT_EN
void GDispPixStrAt(unsigned char x, unsigned char y, const rom unsigned char *pStr,unsigned char fontSpace, char color);
#endif
/*
***********************************************************************************************
*									FUNCTION PROTOTYPES
*									 HARDWARE SPECIFIC
***********************************************************************************************
*/
void 			GDispReset(void);
void			GDispChipSel(unsigned char wing); 
void 			GDispWr(unsigned char type, unsigned char dat);
unsigned char 	GDispRd(unsigned char type);
void 			GDispBackLite(unsigned char ctrl);
/*
***********************************************************************************************
*									FUNCTION PROTOTYPES
*									 EXTRA UTILITIES
***********************************************************************************************
*/
void GDispRec(unsigned char,unsigned char,unsigned char,unsigned char,unsigned char);
void GDispCir(unsigned char,unsigned char,int,unsigned char);
void GDispPic(const rom unsigned char *);
void glcd_pixel(char x, char y, char color);

#endif

⌨️ 快捷键说明

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