LCD1602字符液晶滚动演示程序 ,下面这段程序,指针P ,Q 定义的什么呀?
//待滚动显示的信息段落,每行不超过80个字符,共6行ucharconstLine_Count=6;ucharcodeMsg[][80]={"ManyCADusersdi...
//待滚动显示的信息段落,每行不超过80个字符,共6行
uchar const Line_Count=6;
uchar code Msg[][80]=
{
"Many CAD users dismiss schematic capture as a necessary evil in the ",
"process of creating PCB layout but we have always disputed this point ",
"of view. With PCB layout now offering automation of both component ",
"can often be the most time consuming element of the exercise.",
"And if you use circuit simulation to develop your ideas, ",
"you are going to spend even more time working on the schematic."
};
//显示缓冲(2行)
uchar Disp_Buffer[32];
//垂直滚动显示
void V_Scroll_Display()
{
uchar i,j,k=0;
uchar *p=Msg[0]; //P取值是0~5,表示数组的行;
uchar *q=Msg[Line_Count]+strlen(Msg[Line_Count]);
//以下仅使用显示缓冲的前16字节空间
while(p<q)
{
for(i=0;i<16&&p<q;i++)
{ //消除显示缓冲中待显示行首尾可能出现的空格
if((i==0||i==15)&&*p==' ') p++;
if(*p!='\0')
{
Disp_Buffer[i]=*p++;
}
else
{
if(++k>Line_Count) break;
p=Msg[k]; //p指向下一串的首地址
Disp_Buffer[i]=*p++;
}
}
//不足16个字符时空格补充
for(j=i;j<16;j++) Disp_Buffer[j]=' ';
//垂直滚动显示
while(F0) DelayMS(5);
ShowString(0,0," ");
DelayMS(150);
while(F0) DelayMS(5);
ShowString(0,1,Disp_Buffer);
DelayMS(150);
while(F0) DelayMS(5);
ShowString(0,0,Disp_Buffer);
ShowString(0,1," ");
DelayMS(150);
}
//最后清屏
ShowString(0,0," ");
ShowString(0,1," ");
} 展开
uchar const Line_Count=6;
uchar code Msg[][80]=
{
"Many CAD users dismiss schematic capture as a necessary evil in the ",
"process of creating PCB layout but we have always disputed this point ",
"of view. With PCB layout now offering automation of both component ",
"can often be the most time consuming element of the exercise.",
"And if you use circuit simulation to develop your ideas, ",
"you are going to spend even more time working on the schematic."
};
//显示缓冲(2行)
uchar Disp_Buffer[32];
//垂直滚动显示
void V_Scroll_Display()
{
uchar i,j,k=0;
uchar *p=Msg[0]; //P取值是0~5,表示数组的行;
uchar *q=Msg[Line_Count]+strlen(Msg[Line_Count]);
//以下仅使用显示缓冲的前16字节空间
while(p<q)
{
for(i=0;i<16&&p<q;i++)
{ //消除显示缓冲中待显示行首尾可能出现的空格
if((i==0||i==15)&&*p==' ') p++;
if(*p!='\0')
{
Disp_Buffer[i]=*p++;
}
else
{
if(++k>Line_Count) break;
p=Msg[k]; //p指向下一串的首地址
Disp_Buffer[i]=*p++;
}
}
//不足16个字符时空格补充
for(j=i;j<16;j++) Disp_Buffer[j]=' ';
//垂直滚动显示
while(F0) DelayMS(5);
ShowString(0,0," ");
DelayMS(150);
while(F0) DelayMS(5);
ShowString(0,1,Disp_Buffer);
DelayMS(150);
while(F0) DelayMS(5);
ShowString(0,0,Disp_Buffer);
ShowString(0,1," ");
DelayMS(150);
}
//最后清屏
ShowString(0,0," ");
ShowString(0,1," ");
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询