📄 lcd.c
字号:
#include<atmega128.h>
#include "PORT.h"
/****************************************************************/
/********** LCD Delay **********/
/****************************************************************/
void Delay(int p)
{
int j = 0;
for(j = 0; j < p; j++); // LCD Delay Loutin
}
/****************************************************************/
/********** LCD Enable Signal Pulse **********/
/****************************************************************/
int Command(int inst)
{
int i;
RS = 0; // Register Select Low = Instruction
RW = 0; // Low = Write(MPU -> LCD)
E = 1; // Enable for Read Operation
for(i = 0; i < 10; i++);
P0 = inst;
E = 0; // Enable for Write Operation
}
/****************************************************************/
/********** LCD 檬扁拳 **********/
/****************************************************************/
void Lcd_Init()
{
E = 0;
Delay(100000);
Command(FUNSET); // Function Set = 8bit, 2Line, 5*7Dot
Delay(400);
Command(ALLCLR); // Display clear
Delay(160);
Command(ENTSET); // Entry Mode Set = Display Shift (唱吝 臂
Delay(400);
Command(DISON); //Display ON/OFF Control = 拳搁 ON, Cursor ON,
Delay(400);
}
/****************************************************************/
/********** Main **********/
/****************************************************************/
void main()
{
Lcd_Init(); // 檬扁拳 龋免
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -