标题:
display.h头文件下载
[打印本页]
作者:
das
时间:
2015-4-18 03:36
标题:
display.h头文件下载
12864液晶显示display.h基于msp430单片机头文件代码最后的复制代码保存到电脑的方式实现下载:
uchar a=0,c=80;
uint dianya[11];
uchar dianliu[11];
//uchar key_value;
//uchar FLAG=0;
void display_voltage(unsigned int result_zz1)//显示电压
{ DisplayCgrom(0x90," ");
DisplayCgrom(0x90,"电压: ");
unsigned char temp_value[6];
temp_value[0]=(result_zz1/1000)+0x30; //加(0x30)=48,‘0’,化int数字为char数字字符
temp_value[1]=(result_zz1%1000/100)+0x30;
temp_value[2]='.';
temp_value[3]=(result_zz1%1000/10%10)+0x30;
temp_value[4]=(result_zz1%10 )+0x30;
temp_value[5]=' ';
if(temp_value[0]==0)temp_value[0]=' ';
LCD_write_str(0x03,1,temp_value);
LCD_write_str(0x06,1,"v ");
dianya[a]=result_zz1;
}
void display_current(unsigned int result_zz1)//显示电流
{
unsigned char temp_value[4];
temp_value[0]=(result_zz1/100)+0x30; //加(0x30)=48,‘0’,化int数字为char数字字符
temp_value[1]='.';
temp_value[2]=(result_zz1/10%10)+0x30;
temp_value[3]=(result_zz1%10 )+0x30;
LCD_write_str(0x04,0,temp_value);
LCD_write_str(0x06,0,"A ");
dianliu[a]=result_zz1;
}
void display_set(void)//设定电流
{
uchar b[4];
b[0]=(a/10)+0x30;
b[1]=(a%10)+0x30;
if(a/10==0)b[0]=' ';
b[2]=0+0x30;b[3]=0+0x30;
if(a==0){b[1]=' ';b[2]=' ';}
DisplayCgrom(0x88,"设定电流: ");
LCD_write_str(0x05,2,b);
LCD_write_str(0x07,2,"MA");
}
void display_caculate(void)//计算电源负载调整率
{ DisplayCgrom(0x98," ");
DisplayCgrom(0x98,"负载调整率:");
uchar d[4];
d[0]=c/100+0x30;
d[1]=c%100/10+0x30;
d[2]=c%100%10+0x30;
if(c/100==0)d[0]=':';
d[3]=' ';
LCD_write_str(0x05,3,d);
LCD_write_str(0x07,3," %");
}
//
void key_inint(void)
{ P1DIR=0X00;
P1IE=0X30;
P1IES=0X30;
P1IFG=0X00;
_EINT();
}
#pragma vector=PORT1_VECTOR
__interrupt void port1(void)
{
switch(P1IFG)
{
case 0x10:a++;delay_ms(1);break;
case 0x20:a--;delay_ms(1);break;
default:P1IFG=0X00;break;
}
P1IFG=0X00;
if(a>=11)a=0;
//caculate1();
}
/*uchar readkey(void)
{unsigned char shu;
shu=P1IN&0xf0;
if(shu!=0xf0)
{delay_ms(10);
if(shu!=0xf0)
{FLAG=1;
return shu;}
else return 0xf0;
}
else return 0xf0;
}
void seta()
{ FLAG=0;
a++;
if(a>10)a=1;
}
void setb()
{ FLAG=0;
a--;
if(a<1)a=10;
}
void key()
{unsigned key;
key=readkey();
switch(key)
{case 0xe0:seta();break;//设定电流比例
case 0xd0:setb();break;
case 0xb0:break;
case 0x70:break;
case 0xf0:break;
}
}
*/
复制代码
作者:
shitao370481
时间:
2019-5-20 15:21
66666666
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1