📄 lcd.c
字号:
//LCD DISPLAY
#include "lcd.h"
void LCD_Delay (unsigned long int d)
{
unsigned long int n;
for (n = 0; n < d; n++);
}
void LCD_IO_INIT (void)
{
DataDDR = 0xFF; // Selected PORT is the LCD DATA LINES
DataPort = 0x00;
CtrlDDR |= 0x07; // the LCD CONTROL LINES
CtrlPort |= 0x05; // LCD_RS = HIGH, LCD_RW = LOW, LCD_E = HIGH,
LCD_Delay (500); // Wait for the up LCD to power up
}
void LCD_INIT (void)
{
LCD_PutCmd (PWR_CMD); // Power up the display
LCD_PutCmd (DL_CMD); // Set to 4 lines, 8 bit, no cursor
LCD_PutCmd (CLR_DSP); // Clear the display
LCD_Delay (500); // Wait for the LCD to boot up
LCD_PutCmd(LINE1);
LCD_PutString("System Starting"); //init message displayed on line 1
}
void LCD_PutCmd (char c)
{
CtrlPort &= ~(1<<LCD_RS);
LCD_Delay (5); // Wait for the proper setup time to respond to the RS control line
LCD_PutChar(c);
LCD_Delay (5); // Wait for the proper setup time to respond to the command being applied
CtrlPort |= (1<<LCD_RS);
}
void LCD_PutChar (char c)
{
CtrlPort |= (1<<LCD_E);
LCD_Delay (5); // Wait for the proper setup time to respond to the E pulse
DataPort = c;
LCD_Delay (5); // Wait for the proper setup time to respond to the character being applied
CtrlPort &= ~(1<<LCD_E);
}
void LCD_PutString (unsigned char *p)
{
// Keep sending data until the p pointer is end.
while(*p) {
LCD_PutChar(*p);
p++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -