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

📄 ks0108.h

📁 Mp3 Player using ATmega128, VS1003B, Character LCD. Test OK.Good Sound.
💻 H
字号:
/*! \file ks0108.h \brief Graphic LCD driver for HD61202/KS0108 displays. */
//*****************************************************************************
//
// File Name	: 'ks0108.h'
// Title		: Graphic LCD driver for HD61202/KS0108 displays
// Author		: Pascal Stang - Copyright (C) 2001-2003
// Date			: 10/19/2002
// Revised		: 5/1/2003
// Version		: 0.5
// Target MCU	: Atmel AVR
// Editor Tabs	: 4
//
// NOTE: This code is currently below version 1.0, and therefore is considered
// to be lacking in some functionality or documentation, or may not be fully
// tested.  Nonetheless, you can expect most functions to work.
//
// This code is distributed under the GNU Public License
//		which can be found at http://www.gnu.org/licenses/gpl.txt
//
//*****************************************************************************


#ifndef KS0108_H
#define KS0108_H

#include "../global.h"

//------------------------------------------------------------------------//
// 器飘 沥狼
// Control Signal
#define GLCD_CTRL_PORT	PORTC	// PORT for LCD control signals
#define GLCD_CTRL_DDR	DDRC	// DDR register of LCD_CTRL_PORT
	#define GLCD_CTRL_CS1	0		// pin for LCD Controller 1 Chip Select(*)
	#define GLCD_CTRL_CS0	1		// pin for LCD Controller 0 Chip Select
	#define GLCD_CTRL_RW	2		// pin for LCD Read/Write
	#define GLCD_CTRL_RS	3		// pin for LCD Register Select (D/I)
	#define GLCD_CTRL_E		4		// pin for LCD Enable


//------------------------------------------------------------------------//
// 器飘 沥狼
// Data Signal
#define GLCD_DATA_PORT	PORTA	// PORT for LCD data signals
#define GLCD_DATA_DDR	DDRA	// DDR register of LCD_DATA_PORT
#define GLCD_DATA_PIN	PINA	// PIN register of LCD_DATA_PORT


//------------------------------------------------------------------------//
// HD61202/KS0108 Command set
#define GLCD_ON_CTRL		0x3E	// 0011111X: lcd on/off control
#define GLCD_ON_DISPLAY		0x01	//		DB0: turn display on

#define GLCD_START_LINE		0xC0	// 11XXXXXX: set lcd start line

#define GLCD_SET_PAGE		0xB8	// 10111XXX: set lcd page (X) address
#define GLCD_SET_Y_ADDR		0x40	// 01YYYYYY: set lcd Y address

#define GLCD_STATUS_BUSY	0x80	// (1)->LCD IS BUSY
#define GLCD_STATUS_ONOFF	0x20	// (0)->LCD IS ON
#define GLCD_STATUS_RESET	0x10	// (1)->LCD IS RESET



//------------------------------------------------------------------------//
// gLCD狼 controller 荐 备窍扁
#define GLCD_NUM_CONTROLLERS	((GLCD_XPIXELS+GLCD_CONTROLLER_XPIXELS-1)/GLCD_CONTROLLER_XPIXELS)

//------------------------------------------------------------------------//
// LCD 胶棋 沥狼
#define GLCD_XPIXELS			128		// pixel width of entire display
#define GLCD_YPIXELS			64		// pixel height of entire display
#define GLCD_CONTROLLER_XPIXELS	64		// pixel width of one display controller

//------------------------------------------------------------------------//
// 焊咯瘤绰 咆胶飘 荤捞令 瘤沥
// Set text size of display
#define GLCD_TEXT_LINES           8     // visible lines
#define GLCD_TEXT_LINE_LENGTH    22     // internal line length


// typedefs/structures
typedef struct struct_GrLcdCtrlrStateType
{
	unsigned char xAddr;
	unsigned char yAddr;
} GrLcdCtrlrStateType;

typedef struct struct_GrLcdStateType
{
	unsigned char lcdXAddr;
	unsigned char lcdYAddr;
	GrLcdCtrlrStateType ctrlr[GLCD_NUM_CONTROLLERS];
} GrLcdStateType;

//------------------------------------------------------------------------//
// 窃荐 橇肺配鸥涝 沥狼
// gLCD 器飘 檬扁拳
void glcdInitHW(void);
// 咯矾俺狼 Controller吝 茄俺 急琶
void glcdControllerSelect(U8 controller);
// gLCD啊 Busy啊 场朝锭鳖瘤 措扁
void glcdBusyWait(U8 controller);
// gLCD俊 command 傈价
void glcdControlWrite(U8 controller, U8 data);
// gLCD狼 饭瘤胶磐 佬绢坷扁
U8 glcdControlRead(U8 controller);
// gLCD俊 单捞磐 傈价
void glcdDataWrite(U8 data);
// gLCD狼 单捞磐 佬绢坷扁
U8 glcdDataRead(void);
// gLCD狼 X谅钎 汲沥
void glcdSetXAddress(U8 xAddr);
// gLCD狼 Y谅钎 汲沥
void glcdSetYAddress(U8 yAddr);

/********************* PUBLIC FUNCTIONS **********************/
// gLCD 檬扁拳
void glcdInit(void);
// gLCD 谅钎 檬扁拳 (0, 0)
void glcdHome(void);
// 拳搁 瘤快扁
void glcdClearScreen(void);
// gLCD 矫累扼牢 汲沥
void glcdStartLine(U8 start);
// gLCD X, Y谅钎 汲沥
void glcdSetAddress(U8 x, U8 yLine);

// 
void glcdGotoChar(U8 line, U8 col);


#endif


⌨️ 快捷键说明

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