📄 lcd.c
字号:
float c=0; //画斜线平均增量
float d=0;
lcd_psw=0x00; //设置LCD为单点写入方式,不进行自动换行功能
a=(stop_x-start_x)*5;
b=(stop_y-start_y)*2;
c=(float)a/((float)abs(b));
if(a==0){ //画竖线
if(b==0){ //画点
lcd_xaddrl=start_x*5+152;
lcd_xaddrh=(start_x*5+152)>>8;
lcd_yaddrl=256-start_y*2;
lcd_yaddrh=(256-start_y*2)>>8;
lcd_data=color;
}
else if(b>0){ //画线
lcd_xaddrl=start_x*5+152;
lcd_xaddrh=(start_x*5+152)>>8;
y=256-start_y*2;
while(b!=0){
lcd_yaddrl=y;
lcd_yaddrh=y>>8;
lcd_data=color;
y--;
b--;
}
}
else {
lcd_xaddrl=start_x*5+152;
lcd_xaddrh=(start_x*5+152)>>8;
y=256-start_y*2;
b=abs(b);
while(b!=0){
lcd_yaddrl=y;
lcd_yaddrh=y>>8;
lcd_data=color;
y++;
b--;
}
}
}
else if(b==0){ //画横线
lcd_yaddrl=256-start_y*2;
lcd_yaddrh=(256-start_y*2)>>8;
x=152+start_x*5;
while(a!=0){
lcd_xaddrl=x;
lcd_xaddrh=x>>8;
lcd_data=color;
x++;
a--;
}
}
else { //画斜线
if(b>0){
x1=152+start_x*5;
y=256-start_y*2;
d=0;
while(b!=0){
lcd_xaddrl=x;
lcd_xaddrh=x>>8;
lcd_yaddrl=y;
lcd_yaddrh=y>>8;
lcd_data=color;
d=d+c;
x=x1+d;
y--;
b--;
}
}
else {
x1=152+start_x*5;
y=256-start_y*2;
b=abs(b);
d=0;
while(b!=0){
lcd_xaddrl=x;
lcd_xaddrh=x>>8;
lcd_yaddrl=y;
lcd_yaddrh=y>>8;
lcd_data=color;
d=d+c;
x=x1+d;
y++;
b--;
}
}
}
}
void pt(unsigned char p1,unsigned char p2,unsigned char p3,unsigned char p4,unsigned char p5,
unsigned int t1,unsigned int t2,unsigned int t3,unsigned int t4,unsigned int t5,unsigned int t6,
unsigned int t7,unsigned char yq,unsigned char lq){
unsigned int x,y; //行列计数器
unsigned int temp,temp1;
lcd_psw=0x06; //清除曲线显示区域
lcd_bcolor=0xff;
lcd_fcolor=0xf0;
for(y=0;y<218;y++){
lcd_yaddrl=y+37;
lcd_yaddrh=(y+37)>>8;
lcd_xaddrl=152;
lcd_xaddrh=0;
lcd_data=0x80;
x=0;
while(x<62){
lcd_data=0x00;
x++;
}
}
if(p1>99)p1=99;
if(p2>99)p2=99;
if(p3>99)p3=99;
if(p4>99)p4=99;
if(p5>99)p5=99;
temp=0;
temp1=temp+(unsigned int)yq*10;
if(temp1>999)temp1=999;
draw_line(temp1/10,0,temp1/10,p1,0xf0); //p1
temp=temp1;
temp1+=t1;
if(temp1>999)temp1=999;
draw_line(temp/10,p1,temp1/10,p2,0xf0); //p1-p2
temp=temp1;
temp1+=t2;
if(temp1>999)temp1=999;
draw_line(temp/10,p2,temp1/10,p2,0xf0); ///p2
temp=temp1;
temp1+=t3;
if(temp1>999)temp1=999;
draw_line(temp/10,p2,temp1/10,p3,0xf0); //p2-p3
temp=temp1;
temp1+=t4;
if(temp1>999)temp1=999;
draw_line(temp/10,p3,temp1/10,p3,0xf0); //p3
temp=temp1;
temp1+=t5;
if(temp1>999)temp1=999;
draw_line(temp/10,p3,temp1/10,p4,0xf0); //p3-p4
temp=temp1;
temp1+=t6;
if(temp1>999)temp1=999;
draw_line(temp/10,p4,temp1/10,p4,0xf0); //p4
temp=temp1;
temp1+=t7;
if(temp1>999)temp1=999;
draw_line(temp/10,p4,temp1/10,p5,0xf0); //p4-p5
temp=temp1;
draw_line(temp/10,p5,temp/10,0,0xf0); //p5
}
/**************************************************************************************
主菜单界面
功能:
可以切换的界面:
1 按<控制>可以切换到picture4:控制界面
2 按<存储>可以切换到picture8:存储界面
3 按<提取>可以切换到picture7:提取界面
4 按<查询>
5 按<登录>可以切换到picture6:登录界面
6 按<返回>可以切换到picture9或picture11:L/R功率时间界面
**************************************************************************************/
void picture1(void){
lcd_cls(LCDBCOLOR); //清屏白色
draw(16,8,784,472,LCDFW1COLOR); //显示屏边框
draw(160,280,272,328,LCDFW1COLOR); //控制框
write_word(184,288,32,32,LCDBCOLOR,LCDFTCOLOR,t1);
write_word(216,288,32,32,LCDBCOLOR,LCDFTCOLOR,t2);
draw(344,280,456,328,LCDFW1COLOR); //存储框
write_word(368,288,32,32,LCDBCOLOR,LCDFTCOLOR,t3);
write_word(400,288,32,32,LCDBCOLOR,LCDFTCOLOR,t4);
draw(528,280,640,328,LCDFW1COLOR); //提取框
write_word(552,288,32,32,LCDBCOLOR,LCDFTCOLOR,t5);
write_word(584,288,32,32,LCDBCOLOR,LCDFTCOLOR,t6);
draw(344,380,456,428,LCDFW1COLOR); //返回框
write_word(368,388,32,32,LCDBCOLOR,LCDFTCOLOR,t9);
write_word(400,388,32,32,LCDBCOLOR,LCDFTCOLOR,t10);
write_word(320,88,160,48,LCDBCOLOR,LCDFTCOLOR,hz2);
write_word(320,150,160,60,LCDBCOLOR,LCDFTCOLOR,hz3);
write_word(332,220,160,20,LCDBCOLOR,LCDFTCOLOR,hz4);
}
/***************************************************************************************
单通道功率调整
入口参数:
p_num:通道序号
flag:数据刷新标志 1:刷新全部数据 2:刷新变量
key:0-9按键 11清除
***************************************************************************************/
void picture2(unsigned char p_num,unsigned char flag,unsigned char key){
static unsigned char i=0;
unsigned int j,k;
unsigned int lenx,leny;
if(flag==1){
i=1;
lcd_cls(LCDBCOLOR); //清屏白色
draw(16,8,784,472,LCDFW1COLOR); //显示屏边框
draw(184,63,360,111,LCDFW2COLOR); //P2功率调整
for(j=0;j<3;j++){
for(k=0;k<3;k++){
lenx=k*128;
leny=j*102;
draw(408+lenx,63+leny,488+lenx,111+leny,LCDFW1COLOR);
write_word(440+lenx,71+leny,16,32,LCDBCOLOR,LCDFTCOLOR,number(k+3*j+1)); //n
}
}
draw(184,165,360,213,LCDFW2COLOR); //%1
write_word(288,173,16,32,LCDBCOLOR,LCDFTCOLOR,o1); //%1
draw(184,267,360,315,LCDFW2COLOR); //%2
write_word(288,275,16,32,LCDBCOLOR,LCDFTCOLOR,o1); //%2
draw(56,369,136,417,LCDFW1COLOR); //返回
draw(184,369,360,417,LCDFW1COLOR); //ENT
draw(408,369,488,417,LCDFW1COLOR); //-
draw(536,369,616,417,LCDFW1COLOR); //0
draw(664,369,744,417,LCDFW1COLOR); //清除
write_word(64,173,32,32,LCDBCOLOR,LCDFTCOLOR,t11); //修
write_word(96,173,32,32,LCDBCOLOR,LCDFTCOLOR,t12); //改
write_word(64,285,32,32,LCDBCOLOR,LCDFTCOLOR,t13); //当
write_word(96,285,32,32,LCDBCOLOR,LCDFTCOLOR,t14); //前
write_word(64,377,32,32,LCDBCOLOR,LCDFTCOLOR,t9); //返
write_word(96,377,32,32,LCDBCOLOR,LCDFTCOLOR,t10); //回
write_word(192,71,16,32,LCDBCOLOR,LCDFTCOLOR,e1); //P
write_word(208,71,16,32,LCDBCOLOR,LCDFTCOLOR,number(p_num));
write_word(224,71,32,32,LCDBCOLOR,LCDFTCOLOR,t15); //功
write_word(256,71,32,32,LCDBCOLOR,LCDFTCOLOR,t16); //率
write_word(288,71,32,32,LCDBCOLOR,LCDFTCOLOR,t17); //调
write_word(320,71,32,32,LCDBCOLOR,LCDFTCOLOR,t18); //整
if(key>99)key=99;
write_word(192,275,16,32,LCDBCOLOR,LCDFTCOLOR,number(key/10)); //添加百分值
write_word(208,275,16,32,LCDBCOLOR,LCDFTCOLOR,number(key%10));
write_word(248,377,16,32,LCDBCOLOR,LCDFTCOLOR,e2); //E
write_word(264,377,16,32,LCDBCOLOR,LCDFTCOLOR,e3); //N
write_word(280,377,16,32,LCDBCOLOR,LCDFTCOLOR,e4); //T
write_word(440,377,16,32,LCDBCOLOR,LCDFTCOLOR,o2); //-
write_word(568,377,16,32,LCDBCOLOR,LCDFTCOLOR,n10); //0
write_word(672,377,32,32,LCDBCOLOR,LCDFTCOLOR,t19); //清
write_word(704,377,32,32,LCDBCOLOR,LCDFTCOLOR,t20); //除
}
else if(flag==2){
if(key==11){
i=1;
write_word(192,173,16,32,LCDBCOLOR,LCDFTCOLOR,number(key)); //添加百分值
write_word(208,173,16,32,LCDBCOLOR,LCDFTCOLOR,number(key));
}
else{
if(i==1)write_word(192,173,16,32,LCDBCOLOR,LCDFTCOLOR,number(key)); //添加百分值
if(i==2)write_word(208,173,16,32,LCDBCOLOR,LCDFTCOLOR,number(key));
i++;
}
}
}
/***************************************************************************************
功率调整界面
入口参数:
flag:数据刷新标志 1:刷新全部 2:刷新数据框
lr:通道选择 0:L 1:R
key:0-9按键值 11清除
***************************************************************************************/
void picture3(unsigned char flag ,unsigned char lr,unsigned char key){
static unsigned char i=0;
unsigned int j,k;
unsigned int lenx,leny;
if(flag==1){
i=1;
lcd_cls(LCDBCOLOR); //清屏白色
draw(16,8,784,472,LCDFW1COLOR); //显示屏边框
draw(104,63,360,111,LCDFW2COLOR); //控制框
if(lr==1)write_word(168,71,16,32,LCDBCOLOR,LCDFTCOLOR,e6); //R
else write_word(168,71,16,32,LCDBCOLOR,LCDFTCOLOR,e5); //l
write_word(184,71,32,32,LCDBCOLOR,LCDFTCOLOR,t15); //功
write_word(216,71,32,32,LCDBCOLOR,LCDFTCOLOR,t16); //率
write_word(248,71,32,32,LCDBCOLOR,LCDFTCOLOR,t17); //调
write_word(280,71,32,32,LCDBCOLOR,LCDFTCOLOR,t18); //整
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -