LCD1602滚动显示切换播放暂停字符串
显示Public Places
显示No Smoking
播放
暂停
cppchar zifu1[] = "Public Places ";
char zifu2[] = "Class Now ";
char zifu3[] = "No admittance ";
char *zifu[] = { zifu1, zifu2, zifu3 };
char juti_L[3] = { 16, 16, 16 };
char zifu12[] = "No Smoking ";
char zifu22[] = "Quiet Please ";
char zifu32[] = "Staff Only ";
char *zifu22a[] = { zifu12, zifu22, zifu32 };
char juti_L2[3] = { 16, 16, 16 };
int main(void)
{
char key_v;
char time = 0;
char start_char_num = 0;
WDTCTL = WDTPW | WDTHOLD; /* Stop watchdog timer */
Clock_Init(); /* 系统时钟设置 */
key_init(); /*按键初始化 */
Port_init(); /* 显示器引脚初始化 */
LCD_init(); /* 显示器初始化 */
_EINT(); /* 开中断 */
display(0, 0); /* 显示哪一个字符 从哪开始显示 */
display_2(0, 0);
while (1)
{
key_v = KeySscan();
if (key_v != 0)
{
if (key_v == 1)
{
num++;
if (num == 3)
num = 0;
display(num, 0);
display_2(num, 0);
start_char_num = 0;
}
else if (key_v == 2)
{
start = 1;
}
else if (key_v == 3)
{
start = 0;
}
}
delay_ms(10);
if (start == 1)
{
time++;
if (time == 27)
{
time = 0; /* 时间控制 */
start_char_num++; //从哪里开始显示
if (start_char_num >= juti_L[num])
{
start_char_num = 0;
}
display(num, start_char_num); /* 显示哪一个字符 从哪开始显示 */
display_2(num, start_char_num); /* 显示哪一个字符 从哪开始显示 */
}
}
}
}
cpphttps://docs.qq.com/sheet/DUEdqZ2lmbmR6UVdU?tab=BB08J2
本文作者:Dong
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!