📄 st7920.h
字号:
// -------------------------- Header file for st7920.c -------------------------
#ifndef __ST7920__
#define __ST7920__
// --------------------------- Interface Definition ----------------------------
#define LCD_RS P3_0
#define LCD_RW P3_1
#define LCD_E P3_2
#define LCD_DataPort P1
#define LCD_GMODE 0x36 // 8-bit interface, Extended instruction
#define LCD_CMODE 0x30 // 8-bit interface, Extended instruction
// -----------------------------------------------------------------------------
// ---------------------- Constant Definition ----------------------------------
#define iDat 1
#define iCmd 0
#define LCD_CLS 0x01 // Clear LCD screen
#define LCD_HOME 0x02 // LCD Return home
#define LCD_ENTRY 0x06 // Set LCD Entry Mode
#define LCD_C2L 0x10 // Move Cursor to the left
#define LCD_C2R 0x14 // Move Cursor to the right
#define LCD_D2L 0x18 // Move display to the left
#define LCD_D2R 0x1C // Move display to the right
#define LCD_ON 0x0C // Turn on LCD and Cursor
#define LCD_OFF 0x08 // Turn off LCD
#define LCD_CGRAM_ADDR 0x40 // Start address of LCD CGRAM
#define LCD_CGMAX 64 // Max CGRAM bytes
#define LCD_CMAX 144 // Total Columns
#define LCD_XMAX (LCD_CMAX/16) // Total xUnits
#define LCD_YMAX 32 // Total vBits
#define LCD_COL (LCD_CMAX/8)
#define LCD_ROW (LCD_YMAX/16)
#define LCD_CHAR LCD_COL*LCD_ROW
#define LCD_L1 0x80
#define LCD_L2 0x90
//#define LCD_L3 0xA0
//#define LCD_L4 0xB0
// -----------------------------------------------------------------------------
// --------------------------- Function Prototypes -----------------------------
// Write Data or Command to LCD
void SendByte(bit DatCmd, uint8 dByte);
// Write a string to LCD
void SendStr(uint8 code *ptString);
// Set the LCD working mode(Gaphic/Character)
void SetMode(uint8 icmode);
// Set Icon ON/OFF
void SetIcon(uint8 Addr, dByte);
// Move Cursor or display
void Move(uint8 dir);
// Goto specific location
void Gotoxy(uint8 Row, uint8 Col);
// Clear LCD Screen
void Clear(void);
// Wait some time and clear screen
void wait_and_clear(void);
// Tile screen with one data
void Tile(uint8 tData);
// Tile screen with a Chinese Symbol
void cTile(uint16 Hanzi);
// Call built-in Charactors
void CallBuiltinChar(void);
// LCD initialization procedure
void LCD_Initial(void);
// -----------------------------------------------------------------------------
#include "st7920.c"
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -