1602LCD显示器的使用
ddress=expressLength-1;
}
}
else
{
cursorPosition--;//光标位置要--
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
{
if(express[cursorPosition-2+startAddress]==l)//表明为ln
{
deleteOneAndDisplay();
deleteOneAndDisplay();
}
{
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)//把字符向前移动
{
temp=LCDBuffer[0];
for(i=0;i<15;i++)
{
LCDBuffer[i]= LCDBuffer[i+1];//前移动
}
LCDBuffer[15]=temp;
}
void showLogo(void)
{
for(i=0;i<19;i++)
{
loadAndDisplay(0);
moveLogo();
delayms(100);
}
}
1602LCD显示 相关文章:
- 1602LCD显示驱动程序(11-24)
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)