📄 ssd1815.h
字号:
// --------------------- Head file for ssd1815.c -------------------------------
#ifndef __SSD1815__
#define __SSD1815__
// ------------------------ Interface Definition -------------------------------
#define LCD_8BIT // Parallel interface
#define MCU_6800 // MCU6800 8-bit Parallel
//#define MCU_8080 // MCU8080 8-bit Parallel
//#define LCD_4SPI // 4-wire SPI
// --------------------------- Pins Definition ---------------------------------
#ifdef MCU_6800
// MCU6800 8-bit Parallel
#define LCD_CS P3_0 // Chip Selection (Low Effective)
#define LCD_RST P3_1 // Reset (Low Effective)
#define LCD_A0 P3_2 // Data/Command Register Selection
#define LCD_RW P3_3 // Read/Write
#define LCD_E P3_4 // Enable R/W (High Effective)
#define LCD_DataPort P1
#elif defined(MCU_8080)
// MCU8080 8-bit Parallel
#define LCD_CS P3_0 // Chip Selection (Low Effective)
#define LCD_RST P3_1 // Reset (Low Effective)
#define LCD_A0 P3_2 // Data/Command Register Selection
#define LCD_WR P3_3 // Read/Write
#define LCD_RD P3_4 // Enable R/W (High Effective)
#define LCD_DataPort P1
#else
// 4-bit SPI
#define LCD_SID P3_4 // Serial Instructions and data
#define LCD_SCK P3_3 // Serial Clock
#define LCD_A0 P3_2 // Data/Command Register Selection
#define LCD_RST P3_1 // Reset (Low Effectuve)
#define LCD_CS P3_0 // Chip Selection (Low Effective)
#endif
// -----------------------------------------------------------------------------
// -------------------------- Constants definition -----------------------------
#define iDat 1 // Data
#define iCmd 0 // Command
#define LCD_ON 0xAF // Display Enable
#define LCD_OFF 0xAE // Display Disable
#define LCD_L0 0x40 // The address of line 0
#define LCD_P0 0xB0 // The address of page 0
#define LCD_CMAX 96 // Maximal Column of LCD
#define LCD_PMAX 8 // Maximal Page of LCD
#define LCD_LMAX 64 // Maximal Line of LCD
#define LCD_DATN 0xA6 // Normal Display 'H'on
#define LCD_DATR 0xA7 // Reverse Display 'L'on
#define LCD_ADC 0xA0 // Segment Dir(0xA0: Normal, 0xA1: Reverse)
#define LCD_SHL 0xC0 // Common Dir(0xC0: Normal, 0xC8: Reverse)
#define LCD_ALLON 0xA5 // All Pixels on
#define LCD_BACK 0xA4 // Turn back to normal display
#define LCD_BIAS 0xA2 // LCD Bias (1/9 for EG096064A)
#define StaRMW 0xE0 // Start Read-Modify-Write Mode
#define EndRMW 0xEE // End Read-Modify-Write Mode
#define IC_RST 0xE2 // LCD Software Reset
//#define LCD_ICOMAX 12
#ifdef LCD_ICOMAX
uint8 code ICONS[12] =
{
// Collumn Address of Icons
0,4,12,22,26,29,37,48,52,56,66,80
};
#endif
// -----------------------------------------------------------------------------
// --------------------------- Functions Declaration ---------------------------
// Send a data or command to LCD
void SendByte(bit DatCmd, uint8 dByte);
// Set column address
void SetCA(uint8 CAddr);
// Set page address
void SetPA(uint8 PAddr);
// Set LCD Contrast
void SetContrast(uint8 CValue);
// Goto specific position
void Gotoxy(uint8 page, uint8 col);
#ifdef LCD_8BIT
// Read a data from LCD DDRAM
uint8 ReadData(uint8 PAddr, uint8 CAddr);
// Reverse display of Page PAddr
void ReversePage(uint8 PAddr);
#endif
#ifdef LCD_ICOMAX
// Set LCD specific Icon ON/OFF
void SetIcon(uint8 State, uint8 index);
// Turn On/Off all icons
void Allicons(bit State);
// Display each Icon and then hide them one by one
void ICON_Test(void);
#endif
// Tile the LCD screen with two data
void Tile(uint8 fst, uint8 snd);
// Clear the LCD Screen
void Clear(void);
// Clear page X
void ClearPage(uint8 PAddr);
// Wait some time and clear the screen
void wait_and_clear(void);
// Initialize LCD
void LCD_Initial(void);
// Display LCD Test Graphics
void LCD_Test(void);
// -----------------------------------------------------------------------------
#include "ssd1815.c"
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -