微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 1602LCD显示器的使用

1602LCD显示器的使用

时间:11-21 来源:互联网 点击:

ddress=expressLength-1;

}

}

else

{

cursorPosition--;//光标位置要--

//确定endAddress的位置

if(expressLength-startAddress>=16)//表明显示满了

{

endAddress=startAddress+15;

}

else//表明后面还有几个空要填满

{

endAddress=expressLength-1;

}

}

}

void deleteAndDisplay(void)

{

if(startAddress==0&&cursorPosition==0)//表明没法删除了

{

return;

}

if(express[cursorPosition-1+startAddress]==s)//表明为cos

{

if(cursorPosition-6+startAddress>=0&&express[cursorPosition-6+startAddress]==a)

{

deleteOneAndDisplay();

deleteOneAndDisplay();

deleteOneAndDisplay();

deleteOneAndDisplay();

deleteOneAndDisplay();

deleteOneAndDisplay();

}

else

{

deleteOneAndDisplay();

deleteOneAndDisplay();

deleteOneAndDisplay();

}

}

else if(express[cursorPosition-1+startAddress]==n)//表明为sin tan 或者ln

{

if(express[cursorPosition-2+startAddress]==l)//表明为ln

{

deleteOneAndDisplay();

deleteOneAndDisplay();

}

else if(cursorPosition-6+startAddress>=0&&express[cursorPosition-6+startAddress]==a)//表明为arcsin或者acrtan运算

{

deleteOneAndDisplay();

deleteOneAndDisplay();

deleteOneAndDisplay();

deleteOneAndDisplay();

deleteOneAndDisplay();

deleteOneAndDisplay();

}

else//表明为sin、tan

{

deleteOneAndDisplay();

deleteOneAndDisplay();

deleteOneAndDisplay();

}

}

else if(express[cursorPosition-1+startAddress]==g)

{

deleteOneAndDisplay();

deleteOneAndDisplay();

}

else//表明删除一个

{

deleteOneAndDisplay();

}

}

void displayInputExpress(void)//输入时调用的

{

if(keyCode===)

{

return;

}

if(cursorPosition==15&&startAddress+1<=100)

{

startAddress++;

endAddress=14+startAddress;

return;

}

else //仅能提供第一次输入时的显示

{

endAddress=expressLength-1;

cursorPosition++;

return;

}

warning("error 1");

}

void displayModifyExpress(void)

{

if(keyCode===)

{

return;

}

if(keyCode==129||keyCode==130||keyCode==131)//表明为三个字符要输入

{

insertOneAndDisplay();

insertOneAndDisplay();

insertOneAndDisplay();

}

else if(keyCode==139||keyCode==140)

{

insertOneAndDisplay();

insertOneAndDisplay();

}

else if(keyCode>=141&&keyCode<=142)

{

insertOneAndDisplay();

insertOneAndDisplay();

insertOneAndDisplay();

insertOneAndDisplay();

insertOneAndDisplay();

insertOneAndDisplay();

}

else

{

insertOneAndDisplay();

}

}

void dispaly_dataA(void);

void dispaly_dataA(void)

{

if(dataA>=pow(10,36))

{

warning("Answer Over Flow!");

dataA=0;

dispaly_dataA();

}

else

{

sprintf(LCDBuffer,"g",dataA);

loadAndDisplay(1);

}

}

void warning(char *p)

{

sprintf(LCDBuffer,"s",p);

loadAndDisplay(0);

delayms(500);

sprintf(LCDBuffer,"s"," ");//清屏

loadAndDisplay(0);

displayExpress();

}

void moveLogo(void)//把字符向前移动

{

unsigned char i,temp;

temp=LCDBuffer[0];

for(i=0;i<15;i++)

{

LCDBuffer[i]= LCDBuffer[i+1];//前移动

}

LCDBuffer[15]=temp;

}

void showLogo(void)

{

char i;

strcpy(LCDBuffer," HuaQiang_PCB");//上次参加比赛时用的Logo

for(i=0;i<19;i++)

{

loadAndDisplay(0);

moveLogo();

delayms(100);

}

}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top