uchar code display_P0[]={
0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,//P0口由低位向高位依次亮灯(前一位的灯灭)
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,//P0口灯全灭
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,,//P0口灯全灭
0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0xFF,//P0口由高位向低位依次亮灯(前一位的灯灭),最后全灭
0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,//P0口由低位向高位依次亮灯(前一位的灯b不灭)
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //P0口灯全亮
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//P0口灯全亮
0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE, //P0口灯由高位向低位依次灭(前一位不亮),最后仅剩最低位亮灯。
0xFC,0xF9,0xF3,0xE7,0xCF,0x9F,0x3F,0x7F,//P0口以两个亮灯为单位,由低位向高位逐位移动,最后移至最高位,仅剩最高位亮灯。
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, //P0口全灭
0xE7,0xDB,0xBD,0x7E,0xBD,0xDB,0xE7,0xFF,//P0口中间两位亮灯,然后两个亮灯分别向两端移动,当分别移至最高位和最低位时,再按原方法返回,返回至起始状态后全灭。
0xE7,0xC3,0x81,0x00,0x81,0xC3,0xE7,0xFF,//P0口中间两位亮灯,然后两个亮灯分别向两端扩散,当分别扩散至次高位和次低位时,再按原方法恢复,返回至起始状态后全灭。
0xAA,0x55,0x18,0xFF,0xF0,0x0F,0x00,0xFF,//差位两灭,先是最高位亮,然后最高位灭;再变成中间两位灭,其余的全亮;全灭→低四位亮→高四位亮→全灭。
0xFF,0x00,0x00,0xFF,0xFF };//全灭→全亮→全亮→全灭→全灭
uchar code display_P2[]={ //P2口可参照P0口流水灯情况。基本相同。
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,
0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00, //
0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, //
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,
0xFC,0xF9,0xF3,0xE7,0xCF,0x9F,0x3F,0xFF, //
0xE7,0xDB,0xBD,0x7E,0xBD,0xDB,0xE7,0xFF,
0xE7,0xC3,0x81,0x00,0x81,0xC3,0xE7,0xFF,
0xAA,0x55,0x18,0xFF,0xF0,0x0F,0x00,0xFF,
0xFF,0x00,0x00,0xFF,0xFF };
//这是一个花样流水灯控制程序,主程序没有,由数组值来控制
#include
#include
#define uchar unsigned char
#define uint unsigned int
uchar code display_P0[]={ //这个数组控制P0口花样流水灯的显示
0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0xFF,
0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE, //
0xFC,0xF9,0xF3,0xE7,0xCF,0x9F,0x3F,0x7F,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, //
0xE7,0xDB,0xBD,0x7E,0xBD,0xDB,0xE7,0xFF,
0xE7,0xC3,0x81,0x00,0x81,0xC3,0xE7,0xFF,
0xAA,0x55,0x18,0xFF,0xF0,0x0F,0x00,0xFF,
0xFF,0x00,0x00,0xFF,0xFF };
uchar code display_P2[]={ //这个数组控制P2口花样流水灯的显示。
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,
0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00, //
0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, //
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,
0xFC,0xF9,0xF3,0xE7,0xCF,0x9F,0x3F,0xFF, //
0xE7,0xDB,0xBD,0x7E,0xBD,0xDB,0xE7,0xFF,
0xE7,0xC3,0x81,0x00,0x81,0xC3,0xE7,0xFF,
0xAA,0x55,0x18,0xFF,0xF0,0x0F,0x00,0xFF,
0xFF,0x00,0x00,0xFF,0xFF };
/**********************************************************/
void delayms(uint ms) //延时程序,这里不全。
// 延时子程序
{
uchar k;
while(ms--)
{
看不懂,
你这仅仅是一段数据
还有一个不完整的延时子函数
连个主函数也没有
没人能看懂,
但是我却明白你可能要表达的意思
其实,同学,你用这种查表方式实现的流水灯,程序结构不太好
我认为还是用循环,移位等办法
OK
没找到主函数~~ 数组里面写的是你想让跑马灯的跑法~~
主函数呢?有意思