📄 p18f_lcd.h
字号:
//
// Defines for I/O ports that provide LCD data & control
// PORTD[0:3]-->DB[4:7]: Higher order 4 lines data bus with bidirectional
// : DB7 can be used as a BUSY flag
// PORTA,2 --> [E] : LCD operation start signal control
// PORTD,5 --> [RW]: LCD Read/Write control
// PORTD,4 --> [RS]: LCD Register Select control
// : "0" for Instrunction register (Write), Busy Flag (Read)
// : "1" for data register (Read/Write)
//
#define CPU_SPEED 16 // CPU speed is 16 Mhz !!
#define LCD_RS PORTDbits.RD4 // The definition of control pins
#define LCD_RW PORTDbits.RD5
#define LCD_E PORTAbits.RA2
#define LCD_DATA LATD // PORTD[0:3] as LCD DB[4:7]
#define DIR_LCD_DATA TRISD
// LCD Module commands
#define DISP_2Line_8Bit 0b00111000
#define DISP_2Line_4Bit 0b00101000
#define DISP_ON 0x00C // Display on
#define DISP_ON_C 0x00E // Display on, Cursor on
#define DISP_ON_B 0x00F // Display on, Cursor on, Blink cursor
#define DISP_OFF 0x008 // Display off
#define CLR_DISP 0x001 // Clear the Display
#define ENTRY_INC 0x006 //
#define ENTRY_INC_S 0x007 //
#define ENTRY_DEC 0x004 //
#define ENTRY_DEC_S 0x005 //
#define DD_RAM_ADDR 0x080 // Least Significant 7-bit are for address
#define DD_RAM_UL 0x080 // Upper Left coner of the Display
// Declaration file for LCD related subroutines
void OpenLCD (void) ;
void WriteCmdLCD ( unsigned char ) ;
void WriteDataLCD( unsigned char ) ;
void putsLCD( char * ) ;
void putrsLCD( const rom far char * ) ;
void putcLCD( unsigned char ) ;
void puthexLCD( unsigned char ) ;
void LCD_Set_Cursor( unsigned char , unsigned char ) ;
void LCD_CMD_W_Timing( void ) ;
void LCD_L_Delay( void ) ;
void LCD_S_Delay( void ) ;
void LCD_DAT_W_Timing ( void ) ;
void LCD_Clear(unsigned char CurY);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -