📄 lcd.h
字号:
/**
LCD functions, header file.
chris <cliechti@gmx.net>
*/
#ifndef LCD_H
#define LCD_H
//Instructions for LCD chip
/** Switch on display.
<B>IMPORTANT:</B> <code>lcdDelay(LCDDELAY2)</code> must be called after
this instruction because the display contoller needs some additional time.
*/
#define LCDON 0x01 //0x00000001 //Switch on display
#define LCDOFF 0x08 //0x00001000 //Switch off display
//#define LCDEMODE 0x06 //0x00000110
//#define LCDFONT 0x21 //0x00100001
/** Clear the display. As this function is exactly the same as "Switch on display",
it needs the same precautions:
IMPORTANT:> lcdDelay(LCDDELAY2) must be called after
this instruction because the display contoller needs some additional time.
*/
#define LCDCLEAR 0x01 //0x00000001
/** Place cursor on a specific display line. The horizontal offset
can be added: LCDLINEx + xoffset. As the line length is limited,
the horizontal offset must not be greater 64
*/
#define LCDLINE1 0x80 //0x10000000
#define LCDLINE2 0xc0 //0x11000000
/** Cursor modes.
*/
#define LCDCURSORON 0x0f //0x00001111 //turn on cursor blinking
#define LCDCURSOROFF 0x0c //0x00001100 //Disable cursor blinking. The cursor is hidden.
/** Set address pointer in CGRAM. An offset can be added:
<code>LCDCGADRSET + offset</code>. As the CGRAM is limited to 64 bytes, the
offset must not exeed 64.
*/
#define LCDCGADRSET 0x40 //0b01000000
/** Set address pointer in DDRAM. An offset can be added:
<code>LCDDDADRSET + offset</code>. As the CGRAM is limited to 128 bytes, the
offset must not exeed 128.
For code redability and ease of use the <code>LCDLINEx</code> command should be
sed!
*/
#define LCDDDADRSET 0x80 //0b10000000
/** these are used for the LCD init and module internally
*/
#define LCD2LINES 0x28 //0b00101000 //Set display mode to two lines.
//Bitpatters for LCDOUT
#define LCD8BITS 0x30 //0b00110000 //select 8 Bit interface
#define LCD4BITS 0x20 //0b00100000 //select 4 Bit interface
#define LCD_DATA_OFF 0x05 //0x00000101 //mask used to clear the data lines
//forward declarations
void lcdOn( void );
void lcdInstr( char cmd );
void lcdPutc( char c );
void lcdInit( void );
void lcdPuts( char * str );
void lcdDelay(unsigned int d);
void lcdDownloadFont( const void * fontdata, int size);
#endif /*LCD_H*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -