240320触摸屏液晶GUI程序

上传人:野鹰 文档编号:1077949 上传时间:2017-05-27 格式:TXT 页数:12 大小:14.95KB
返回 下载 相关 举报
240320触摸屏液晶GUI程序_第1页
第1页 / 共12页
240320触摸屏液晶GUI程序_第2页
第2页 / 共12页
240320触摸屏液晶GUI程序_第3页
第3页 / 共12页
240320触摸屏液晶GUI程序_第4页
第4页 / 共12页
240320触摸屏液晶GUI程序_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《240320触摸屏液晶GUI程序》由会员分享,可在线阅读,更多相关《240320触摸屏液晶GUI程序(12页珍藏版)》请在金锄头文库上搜索。

1、/*/* GUI 图形化用户界面 */* 文件名: gui.c */* 平台: TOP51 + keil C51 */* 公司: 爱晶电子 */* 网址:http:/ */ 描 述: TFT图形用户接口层程序集/* 作者 日期 注释 */*/* 王伟民 08/10/20 原始文件 */* 王伟民 2010/3/30 V1.1移植到STC 高速51单片机*/* 王伟民 2010/4/29 V1.2完善了显示预定义汉字字符串函数,不再需要人工修改字符数了*/* 增加了画矩形和显示长整数和长变量函数*/*/*说明: 数字、英文字符为8*16点阵字形 中文字符为16*16点阵字形 */*/#inclu

2、de stc.h#include top51.h#include GUI/gui.h#include LCM/ILI9325.h#include bmp.h#include 16x8.h#include chinese.h/*清屏入口参数: b_color是背景颜色。出口参数: 无说明:使用背景颜色清除TFT模块屏幕的全部显示内容。*/void GUI_clearscreen(uint b_color)uint i,j;LCD_setwindow(0,0,240,320);for (i=0;ii)=(0x80i)GUI_sprintf_nu(x,y,1,color,b_color) ;else

3、 GUI_sprintf_nu(x,y,0,color,b_color) ;x+=8 ;/*无符号字符型数以 进制形式显示入口参数:(x,y)是显示内容的 上 坐标,dat 是 显示的无符号字符型数,color 是显示字符的颜色,b_color是背景颜色。出口参数: 无说明:无符号字符型数用指定的颜色和背景颜色在指定的坐标位置上以 进制形式显示出 。*/void GUI_sprintf_chartohex(uchar x, uint y,uchar dat, uint color,uint b_color) uchar i ;GUI_sprintf_nu(x,y,dat4,color,b_co

4、lor) ;x+=8 ;GUI_sprintf_nu(x,y,dat&0x0f,color,b_color) ;/*无符号字符型数以 进制形式显示入口参数:(x,y)是显示内容的 上 坐标,dat是 显示的无符号字符型数,color 是显示字符的颜色,b_color是背景颜色。出口参数: 无说明:无符号字符型数用指定的颜色和背景颜色在指定的坐标位置上以 进制形式显示出 。*/void GUI_sprintf_chartodec(uchar x,uint y,uchar dat,uint color,uint b_color)GUI_sprintf_char(x,y,dat/100+0,colo

5、r,b_color);GUI_sprintf_char(x+8,y,dat/10%10+0,color,b_color);GUI_sprintf_char(x+16,y,dat%10+0,color,b_color);/*显示1位16进制数入口参数: (x,y) 是显示内容的 上 坐标,c: 显示的1位16进制数,color:颜色,b_color:背景颜色。出口参数: 无说明:用指定位置上显示1位16进制数。*/void GUI_sprintf_nu(uchar x, uint y,uchar nu, uint color,uint b_color) uchar s_x=0 ,s_y=0, t

6、emp=0 ;uint j;if (nu9)nu=nu+7; nu=nu+16;for(s_y=0;s_y(s_x) = (0x80(s_x) )GUI_Point(x+s_x, y+s_y,color) ;elseGUI_Point(x+s_x, y+s_y,b_color) ;/*画 入口参数: (x,y)是 点坐标,length是 长 ,color 是 颜色。出口参数: 无说明:用指定的颜色在指定位置上画出指定长 的一 。*/void GUI_HLine(uchar x, uint y, uchar length, uint color) LCD_setwindow(x,y,x+leng

7、th-1,y);do write_data_u16(color);/ 点显示,描出 平 length-;while(length);/*画 入口参数: (x,y)是 点坐标,high 高 ,color 是 颜色。出口参数: 无说明:用指定的颜色在指定位置上画出指定长 的一 。*/void GUI_RLine(uchar x, uint y, uint high, uint color) LCD_setwindow(x,y,x,y+high-1);do write_data_u16(color);/ 点显示,描出 high-;while(high);/* 画 以画 , 、 、 。入口参数: (x

8、1,y1) 点, (x2,y2) 点, color颜色。出口参数: 无说明:用指定的颜色在指定的 点 画出一 。*/void GUI_line(uint x1,uint y1,uint x2,uint y2,uint color) uint t; int xerr=0,yerr=0,delta_x,delta_y,distance; int incx,incy; uint row,col; delta_x = x2-x1;/ 坐标增量 delta_y = y2-y1; col=x1; row=y1; if(delta_x0) incx=1;/ 置单 else if(delta_x=0) inc

9、x=0;/ else incx=-1;delta_x=-delta_x; if(delta_y0)incy=1; else if(delta_y=0) incy=0;/ 平 else incy=-1;delta_y=-delta_y; if(delta_xdelta_y) distance=delta_x;/增量坐标 else distance=delta_y; for(t=0;tdistance) xerr-=distance; col+=incx; if(yerrdistance) yerr-=distance; row+=incy; /*显示图片(图标)入口参数:(x,y)是始点的坐标,

10、length是图片长 ,high是图片高 。/pic 图片数currency1的指出口参数: 无说明:用指定位置上显示“定义的图片。要显示的图片“定义在bmp.h中的pic数currency1中,fi修改图片fl 、内容,修改bmp.h中的pic数currency1,用Image2Lcd件 要显示的图”为数currency1数。 */void GUI_DisPicture(uchar x, uint y, uchar length, uint high ,const uchar *pic)void GUI_DisPicture(uchar x, uint y, uchar length, uint high)uint temp=0,tmp=0,num=0;LCD_setwindow(x,y,x+length-1,y+high-1);num=length*high*2;do /temp=pictmp|( pictmp+1(s_x) = (0x80(s_x) ) GUI_Point(x+s_x, y+s_y,color) ;elseGUI_Point(x+s_x, y+s_y,b_color) ;/*

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 研究报告 > 综合/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号