详细功能:
1. 在指定的X轴,Y轴的位置显示16X16或32X32的中英文字符,内置有中英文字库。 (加装64M的NandFlash可支持24X24,48X48,64X64的中英文字符)。
2. 在指定的X轴,Y轴的位置显示直线,圆或椭圆。
3. 显示预置的位图(用PC机预先下载到控制板的图片,支持的图片有256色位图和JPG图,JPG图片在VTer_8060TFT_080的实际显示效果是64K色)
4. 清除全屏或清除指定位置和长宽的矩形。
5. 自动显示实时时钟(可关闭,可指定位置和显示方式)。
6. 所有的功能均可通过单片机的并行口或RS232串行口发送简单的指令完成。
有兴趣朋友主留下邮箱:fenger_lfl@163.com
Read_date();
while(Date[0] == 0){} //等待显示终端机送年月日数据到单片机
for(i=0;i <3;i++)
{
DIS_value((6*16)+(i*24),32,Date[i+1],2);
}
Read_time();
while(Date[4] == 0){} //等待显示终端机送时分秒数据到单片机
for(i=0;i <3;i++)
{
DIS_value((6*16)+(i*24),48,Date[i+5],2);
}
}
*/
//指令头,每一条指令都规定为"0x81, command1,command2,Fcolor,Bcolor"
command_head(unsigned char command1,unsigned char command2)
{
Write_Byte(0x81);
Write_Byte(command1);
Write_Byte(command2);
Write_Byte(Fcolor);
Write_Byte(Bcolor);
}
//清屏子程序
Lcd_Clr()
{
command_head(0x43,0x4c);
Write_Byte(0x84);
}
//保存原桌面内容
void COPY_DC()
{
command_head(0x43,0x44);
Write_Byte(0x84);
}
//恢复原来桌面
void EXIT_DC()
{
command_head(0x45,0x44);
Write_Byte(0x84);
}
Bell() //打开蜂鸣器。
{
Write_Byte(0x81);
Write_Byte(0x42);
Write_Byte(0x42);
Write_Byte(0x01); //设置蜂鸣器的时间
Write_Byte(0x84);
}
// 清矩形
void Clr_squ(unsigned short x0,unsigned short y0,unsigned short width,unsigned short heith)
{
command_head(0x43,0x58);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
Write_Byte(width/100);
Write_Byte(width%100);
Write_Byte(heith/100);
Write_Byte(heith%100);
Write_Byte(0x84);
}
// 反色矩形
void inv_squ(unsigned short x0,unsigned short y0,unsigned short width,unsigned short heith)
{
command_head(0x43,0x4e);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
Write_Byte(width/100);
Write_Byte(width%100);
Write_Byte(heith/100);
Write_Byte(heith%100);
Write_Byte(0x84);
}
/*
//读取年月日
Read_date()
{
Date[0] = 0;
command_head(0x52,0x44);
Write_Byte(0x84);
}
//读取时分秒
Read_time()
{
Date[4] = 0;
command_head(0x52,0x54);
Write_Byte(0x84);
}
*/
//画圆子程序。
DIS_Ellipse(unsigned short x0,unsigned short y0,unsigned short xr,unsigned short yr)
{
command_head(0x44,0x45);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
Write_Byte(xr/100);
Write_Byte(xr%100);
Write_Byte(yr/100);
Write_Byte(yr%100);
Write_Byte(x0/100);
Write_Byte(0x84);
}
/*
//画直线子程序。
DIS_Line(unsigned short x0,unsigned short y0,unsigned short x1,unsigned short y1,unsigned short with)
{
command_head(0x44,0x4c);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
Write_Byte(x1/100);
Write_Byte(x1%100);
Write_Byte(y1/100);
Write_Byte(y1%100);
Write_Byte(with/100);
Write_Byte(with%100);
Write_Byte(0x84);
}
*/
//在指定的开始位置(x0,y0)显示字符串子程序。
//当x0大于800且已打开光标功能时在以光标为开始位置显示字符串子程序。
/*DIS_String(unsigned short x0,unsigned short y0,char *fmt)
{
command_head(0x44,0x57);
//Write_Byte(0xE0);//字体以红色显示
//Write_Byte(0x1C);//背景为透明
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
while(*fmt)
{
Write_Byte(*fmt);
fmt++;
}
Write_Byte(0x84);
}
*/
//在指定的开始位置(x0,y0)显示字符串子程序。
//当x0大于800且已打开光标功能时在以光标为开始位置显示字符串子程序。
DIS_StringN(unsigned short x0,unsigned short y0,char *fmtn,uchar n)
{
uchar i;
command_head(0x44,0x57);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
for(i=0;i {
Write_Byte(*fmtn);
fmtn++;
}
Write_Byte(0x84);
}
//在指定的开始位置(x0,y0)显示字符串子程序。
//当x0大于800且已打开光标功能时在以光标为开始位置显示字符串子程序。
DIS_String64(unsigned short x0,unsigned short y0,char *fmt)
{
command_head(0x54,0x04);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
while(*fmt)
{
Write_Byte(*fmt);
fmt++;
}
Write_Byte(0x84);
}
/*
//显示时间子程序
void Dis_time(unsigned short x0,unsigned short y0,unsigned char i)
{
command_head(0x44,0x54);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
Write_Byte(i);
Write_Byte(0x84);
}
*/
/*
//设置时间子程序;
//年,月,日,时 ,分,秒,星期。
void Set_time(uchar year,uchar month,uchar day,uchar hour,uchar minute,uchar second,uchar date)
{
command_head(0x53,0x54);
Write_Byte(year);
Write_Byte(month);
Write_Byte(day);
Write_Byte(hour);
Write_Byte(minute);
Write_Byte(second);
Write_Byte(date);
Write_Byte(0x84);
}
*/
/*
//显示变量子程序
DIS_value(unsigned short x0,unsigned short y0,unsigned short Va,unsigned char i)
{
command_head(0x44,0x56);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
Write_Byte(Va/100);
Write_Byte(Va%100);
Write_Byte(i);
Write_Byte(0x84);
}
*/
//显示位图子程序
DIS_BMP(unsigned short x0,unsigned short y0,uchar N1)
{
command_head(0x44,0x53);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
Write_Byte(N1);
Write_Byte(0x84);
}
/*
//自动显示位图子程序
AUTO_BMP(unsigned short x0,unsigned short y0,uchar N1,uchar N2,uchar T)
{
command_head(0x5a,0x44);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
Write_Byte(N1);
Write_Byte(N2);
Write_Byte(T);
Write_Byte(0x84);
}
*/
////////////////////////////////////////////////////////////////////////
//显示一个字符
DIS_Byte(unsigned short x0,unsigned short y0,char fmt)
{
command_head(0x44,0x57);
Write_Byte(x0/100);
Write_Byte(x0%100);
Write_Byte(y0/100);
Write_Byte(y0%100);
Write_Byte(fmt);
Write_Byte(0x84);
}