标题: 51单片机控制64位流水灯程序电路原理图 [打印本页]

作者: 马上学习    时间: 2024-11-2 12:29
标题: 51单片机控制64位流水灯程序电路原理图
#include<reg51.h>

const unsigned char P0_arry[8]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
//const unsigned char P0_arry[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
//const unsigned char P2_arry[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
const unsigned char P2_arry[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
void delay(unsigned int time)
{
    unsigned int i, j;
    for(i = 0; i < time; i++)
        for(j = 0; j < 120; j++);
}
void main()
{
  unsigned char i, j;

        while(1)
        {
                for(i=0;i<8;i++)
                {
                        P2 = P2_arry[ i];
                        for(j=0;j<8;j++)
                        {
                                P0 = P0_arry[j];
                                                                                                              delay(200);
                        }                       
                }
        }
}

单片机控制88点阵.png (156.03 KB, 下载次数: 0)

单片机控制88点阵.png

屏幕截图(33).png (168.83 KB, 下载次数: 0)

屏幕截图(33).png





欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1