本文包含原理图、PCB、源代码、封装库、中英文PDF等资源
您需要 登录 才可以下载或查看,没有账号?注册会员
×
#define twoline_8bit 56
#define clear 1
#define cursor_home 2//光标回到左上角
#define cursor_left 4
#define cursor_right 6
#define cursor_off 12
#define cursor_on 14
#define cursor_bink 15
#define goto_line_2 192
#define goto_line_1 128
#define ENABLE 1
#define disable 0
#define read 1
#define write 0
#define command 1
#define data 1
#define rs P3_5
#define rw P3_4
#define enable P3_3
//定义各功能函数
void delay100us(unsigned);
void write_lcd_command(unsigned);
void write_lcd_data(unsigned);
void init_lcd();
void clear_lcd();
void diaplay_lcd_string(char *P);
void gotoxy(unsigned,unsigned);
void display_lcd_number(char);
#include<regx51.h>
#include<LCD.H>
char code int2charlcd[]="0123456789";
void write_lcd_command(unsigned COMMAND)
{
rw=write;//rw位置0
rs=command;//rs位置0
enable=ENABLE;//e位置1
P1=COMMAND;
delay100us(20);
enable=disable;
rw=1;
}
void write_lcd_data(unsigned lcddata)
{
rw=write;
rs=data;
enable=ENABLE; //110以上三句 将数值写入DDRAM或GGRAM
P1=lcddata;
delay100us(20);
enable=ENABLE;
rw=1;//111读取上述值
}
void init_lcd()//模块初始化
{
write_lcd_command(twoline_8bit);
write_lcd_command(cursor_off);
write_lcd_command(cursor_right);
}
void clear_lcd()
{
write_lcd_command(clear);
write_lcd_command(cursor_home);
}
void display_lcd_string(char *P)
{
while(*P)
{
write_lcd_data(*P);
P++;
}
}
void display_lcd_number(char number)
{
unsigned char x,y;
x=number/10;
y=number-10*x;
write_lcd_data(int2charlcd[x]);
write_lcd_data(int2charlcd[y]);
}
void gotoxy(unsigned x,unsigned y)
{
if(x==1)
write_lcd_command(goto_line_1+y);
else
write_lcd_command(goto_line_2+y);
}
void delay100us()//加入汇编延时
{
#pragma asm
more :
move R3,#48
djnz R3,$
djnz R7,more
#pragma endasm
}
#include<regx51.h>
#include <LCD.H>
void main()
{
init_lcd();
clear_lcd();
display_lcd_string("HELLO");
gotoxy(2,1);
display_lcd_string("LCD");
while(1);
}
这个程序 怎么无法识别 文件“LCD.H"
请问 怎么才能调用该 文件 |