?? 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(); // 檬扁拳 齲免
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -