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

📄 st7920.h

📁 ST7920串行方式的源码
💻 H
字号:
/*
**************************************************************************************
*                                            Record                                  *
*                                                                                    *
*                                         Header For YM12864R( ST7920 )				 *
*																					 *
*                                            Wenxin Ma, SSPU, 2005					 *
*                                             All Rights Reserved					 *
*   																				 *
* File : ST7920.h																	 *
* By   : Wenxin Ma, SSPU															 *
* Contact : wxma@sspu.cn															 *
**************************************************************************************
*/
#ifndef	_ST7920_H
#define	_ST7920_H

/*
***************************************************************************************
*  ST7920 Pin Configurations                                        
***************************************************************************************
*/
#define	ST7920_RST 	0x80000000            /* P0.31口为ST7920的Reset */
#define	ST7920_CS 	0x20000000            /* P0.29口为ST7920的片选 */

/*
****************************************************************************************
*  YM12864R Instruction Set Configurations                                        
****************************************************************************************
*/
#define ST7920_WR_INST  0xF8				/*	Write Control Instruction	*/
#define ST7920_RD_INST  0xFC				/*	Read  Control Instruction	*/		
#define ST7920_WR_DATA  0xFA				/*	Write Data to RAM			*/
#define ST7920_FUN_SET  0x30				/*	Function Set Instruction	*/
#define ST7920_DSP_ON   0x0E				/*	Display All On				*/
#define ST7920_DSP_CLR  0x01				/*	Display Clear				*/		
#define ST7920_MODE_SET 0x06				/*	Display Mode Set			*/		

/*
*****************************************************************************************
*  Declarations for ST7920's API Functions                                       
*****************************************************************************************
*/
#define	ST7920_Reset()	( IO0CLR = ST7920_RST, IO0SET = ST7920_RST )	/*	Reset ST7920	*/

void  MspiIni(void);
uint8 MSPI_WriteOneByte(uint8 data);

void ST7920_WriteInstruction(unsigned char Instruc);		/*	Write Instruction Register	*/
void ST7920_WriteData(unsigned char DataRAM);				/*	Write Data RAM				*/
unsigned char ST7920_ReadInstruction(void);					/*	Read Instruction Register	*/
void ST7920_WriteSpaceData(unsigned char startAddress,unsigned char dataNum);
															/*	Write Space Data			*/
void ClearScreen(void);										/*  Clear Screen				*/															
void ST7920_WriteLineData(unsigned char startAddress,unsigned char dataNum, 
                          unsigned char *dataVector);		/*	Write Line Data				*/
void WriteOneScreen(unsigned char startAddress,unsigned char dataNum, 
                          unsigned char *dataVector);		/*	Write One Screen			*/
void WriteScreen(uint8 data);

void  DspTitle(void);
                          
void ST7920Init(void);
#endif

⌨️ 快捷键说明

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