自制44光立方程序无锁存.docx
《自制44光立方程序无锁存.docx》由会员分享,可在线阅读,更多相关《自制44光立方程序无锁存.docx(21页珍藏版)》请在冰豆网上搜索。
![自制44光立方程序无锁存.docx](https://file1.bdocx.com/fileroot1/2023-2/5/1ce1e7c3-b0c7-4ff6-87d2-3ac354a06830/1ce1e7c3-b0c7-4ff6-87d2-3ac354a068301.gif)
自制44光立方程序无锁存
#include
#include
#defineucharunsignedchar
#defineuintunsignedint
/*****************************延时函数******************************/
/*****引脚定义P10-17P20-27竖排P00-P03****/
voidDelay(uintdel)
{
uinti,j;
for(i=0;ifor(j=0;j<18270;j++)
;
}
/*******************************主函数*****************************/
voidmain()
{
uinti;
for(i=2;i>1;i++)
{
for(i=1;i<5;i++)
{
/*单层*/
P0=0X8;
P1=0X00;
P2=0X00;
P0=0X4;
P1=0X0;
P2=0X00;
Delay
(2);
P0=0X2;
P1=0X0;
P2=0X0;
Delay
(2);
P0=0X1;
P1=0X0;
P2=0X0;
Delay
(2);
P0=0X2;
P1=0X0;
P2=0X0;
Delay
(2);
P0=0X4;
P1=0X0;
P2=0X00;
Delay
(2);
/*单层*/
P0=0X8;
P1=0X00;
P2=0X00;
Delay
(2);
}
/**群体闪烁**/
P0=0XFF;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0X00;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0X00;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0X00;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0X00;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0X00;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0X00;
P2=0X00;
Delay
(2);
P0=0X00;
P1=0X00;
P2=0X00;
Delay
(2);
/*渐灭*/
P0=0XFF;
P1=0X80;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0XC0;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0XE0;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0XF0;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0XF8;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0XFC;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0XFE;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0XFF;
P2=0X00;
Delay
(2);
P0=0XFF;
P1=0XFF;
P2=0X80;
Delay
(2);
P0=0XFF;
P1=0XFF;
P2=0XC0;
Delay
(2);
P0=0XFF;
P1=0XFF;
P2=0XE0;
Delay
(2);
P0=0XFF;
P1=0XFF;
P2=0XF0;
Delay
(2);
P0=0XFF;
P1=0XFF;
P2=0XF8;
Delay
(2);
P0=0XFF;
P1=0XFF;
P2=0XFC;
Delay
(2);
P0=0XFF;
P1=0XFF;
P2=0XFE;
Delay
(2);
P0=0XFF;
P1=0XFF;
P2=0XFF;
Delay
(2);
/*zhuan*/
for(i=1;i<10;i++)
{
P0=0XFF;
P2=0XF;
P1=0XFF;
Delay
(1);
P2=0X87;
P1=0XFF;
Delay
(1);
P2=0XC7;
P1=0XEF;
Delay
(1);
P2=0XE7;
P1=0XE7;
Delay
(1);
P2=0XF7;
P1=0XE3;
Delay
(1);
P2=0XFF;
P1=0XE1;
Delay
(1);
P2=0Xff;
P1=0XF0;
Delay
(1);
P2=0XFF;
P1=0X78;
Delay
(1);
P2=0XFE;
P1=0X7C;
Delay
(1);
P2=0X7E;
P1=0X7E;
Delay
(1);
P2=0X3E;
P1=0X7F;
Delay
(1);
P2=0X1E;
P1=0XFF;
Delay
(1);
P0=0XFF;
P2=0XF;
P1=0XFF;
}
/*kuosan*/
for(i=1;i<10;i++)
{
P2=0XF9;
P1=0X9F;
Delay
(1);
P2=0X6;
P1=0X60;
Delay
(1);
P2=0XF9;
P1=0X9F;
Delay
(1);
P2=0X6;
P1=0X60;
Delay
(1);
P2=0XF9;
P1=0X9F;
Delay
(1);
}
/*bianhuan*/
for(i=1;i<8;i++)
{
P2=0X7D;
P1=0XD7;
Delay
(1);/*1*/
P2=0XEB;
P1=0XBE;
Delay
(1);/*2*/
P2=0X7D;
P1=0XD7;
Delay
(1);/*1*/
P2=0XEB;
P1=0XBE;
Delay
(1);/*2*/
P2=0X7D;
P1=0XD7;
Delay
(1);/*1*/
P2=0XEB;
P1=0XBE;
Delay
(1);/*2*/
P2=0X7D;
P1=0XD7;
Delay
(1);/*1*/
P2=0XEB;
P1=0XBE;
Delay
(1);/*2*/
P2=0X7D;
P1=0XD7;
Delay
(1);/*1*/
P2=0XEB;
P1=0XBE;
Delay
(1);/*2*/
P2=0X7D;
P1=0XD7;
Delay
(1);/*1*/
P2=0XEB;
P1=0XBE;
Delay
(1);/*2*/
}
/*蛇*/
for(i=1;i<4;i++)
{
P0=0X1;
P2=0XF;
P1=0XFF;
Delay
(1);
P2=0X87;
P1=0XFF;
Delay
(1);
P2=0XC7;
P1=0XEF;
Delay
(1);
P2=0XE7;
P1=0XE7;
Delay
(1);
P2=0XF7;
P1=0XE3;
Delay
(1);
P2=0XFF;
P1=0XE1;
Delay
(1);
P2=0Xff;
P1=0XF0;
Delay
(1);
P2=0XFF;
P1=0X78;
Delay
(1);
P2=0XFE;
P1=0X7C;
Delay
(1);
P2=0X7E;
P1=0X7E;
Delay
(1);
P2=0X3E;
P1=0X7F;
Delay
(1);
P2=0X1E;
P1=0XFF;
Delay
(1);
P2=0XF;
P1=0XFF;
Delay
(1);/*1ceng*/
P0=0X2;
P2=0XF;
P1=0XFF;
Delay
(1);
P2=0X87;
P1=0XFF;
Delay
(1);
P2=0XC7;
P1=0XEF;
Delay
(1);
P2=0XE7;
P1=0XE7;
Delay
(1);
P2=0XF7;
P1=0XE3;
Delay
(1);
P2=0XFF;
P1=0XE1;
Delay
(1);
P2=0Xff;
P1=0XF0;
Delay
(1);
P2=0XFF;
P1=0X78;
Delay
(1);
P2=0XFE;
P1=0X7C;
Delay
(1);
P2=0X7E;
P1=0X7E;
Delay
(1);
P2=0X3E;
P1=0X7F;
Delay
(1);
P2=0X1E;
P1=0XFF;
Delay
(1);
P2=0XF;
P1=0XFF;
Delay
(1);/*2ceng*/
P0=0X4;
P2=0XF;
P1=0XFF;
Delay
(1);
P2=0X87;
P1=0XFF;
Delay
(1);
P2=0XC7;
P1=0XEF;
Delay
(1);
P2=0XE7;
P1=0XE7;
Delay
(1);
P2=0XF7;
P1=0XE3;
Delay
(1);
P2=0XFF;
P1=0XE1;
Delay
(1);
P2=0Xff;
P1=0XF0;
Delay
(1);
P2=0XFF;
P1=0X78;
Delay
(1);
P2=0XFE;
P1=0X7C;
Delay
(1);
P2=0X7E;
P1=0X7E;
Delay
(1);
P2=0X3E;
P1=0X7F;
Delay
(1);
P2=0X1E;
P1=0XFF;
Delay
(1);
P2=0XF;
P1=0XFF;
Delay
(1);/*3ceng*/
P0=0X8;
P2=0XF;
P1=0XFF;
Delay
(1);
P2=0X87;
P1=0XFF;
Delay
(1);
P2=0XC7;
P1=0XEF;
Delay
(1);
P2=0XE7;
P1=0XE7;
Delay
(1);
P2=0XF7;
P1=0XE3;
Delay
(1);
P2=0XFF;
P1=0XE1;
Delay
(1);
P2=0Xff;
P1=0XF0;
Delay
(1);
P2=0XFF;
P1=0X78;
Delay
(1);
P2=0XFE;
P1=0X7C;
Delay
(1);
P2=0X7E;
P1=0X7E;
Delay
(1);
P2=0X3E;
P1=0X7F;
Delay
(1);
P2=0X1E;
P1=0XFF;
Delay
(1);
P2=0XF;
P1=0XFF;
Delay
(1);/*4ceng*/
}
/*liangliezhuan*/
for(i=1;i<8;i++)
{
P0=0XFF;
P1=0XBE;
P2=0XFF;
Delay
(1);/*1*/
P0=0XFF;
P1=0X3F;
P2=0XFF;
Delay
(1);/*2*/
P0=0XFF;
P1=0XFF;
P2=0XFC;
Delay
(1);/*3*/
P0=0XFF;
P1=0XFF;
P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