#include<stdio.h>
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
/*****************************延时函数******************************/
void Delay(uint del)
{
uint i,j;
for(i=0; i<del; i++)
for(j=0; j<18270; j++)
;
}
/*******************************主函数*****************************/
main()
{
/***************群体闪烁********************/
P0=0XF0;
P1=0X00;
P2=0X00;
Delay(10);
P1=0XFF;
P2=0XFF;
Delay(10);
P1=0X00;
P2=0X00;
Delay(10);
P1=0XFF;
P2=0XFF;
Delay(10);
P1=0X00;
P2=0X00;
Delay(10);
P1=0XFF;
P2=0XFF;
Delay(10);
/*********************************列断续扫描**************************/
P0=0X00;
P1=0X1;
P2=0X00;
Delay(10);/*1*/
P1=0X2;
P2=0X00;
Delay(10);/*2*/
P1=0X4;
P2=0X00;
Delay(10);/*3*/
P1=0X8;
P2=0X00;
Delay(10);/*4*/
P1=0X10;
P2=0X00;
Delay(10);/*5*/
P1=0X20;
P2=0X00;
Delay(10);/*6*/
P1=0X40;
P2=0X00;
Delay(10);/*7*/
P1=0X80;
P2=0X00;
Delay(10);/*8*/
P1=0X00;
P2=0X1;
Delay(10);/*9*/
P1=0X00;
P2=0X2;
Delay(10);/*10*/
P1=0X00;
P2=0X4;
Delay(10);/*11*/
P1=0X00;
P2=0X8;
Delay(10);/*12*/
P1=0X00;
P2=0X10;
Delay(10);/*13*/
P1=0X00;
P2=0X20;
Delay(10);/*14*/
P1=0X00;
P2=0X40;
Delay(10);/*15*/
P1=0X00;
P2=0X80;
Delay(10);/*16*/
P1=0X00;
P2=0X40;
Delay(10);/*15*/
P1=0X00;
P2=0X20;
Delay(10);/*14*/
P1=0X00;
P2=0X10;
Delay(10);/*13*/
P1=0X00;
P2=0X8;
Delay(10);/*12*/
P1=0X00;
P2=0X4;
Delay(10);/*11*/
P1=0X00;
P2=0X2;
Delay(10);/*10*/
P1=0X00;
P2=0X1;
Delay(10);/*9*/
P1=0X80;
P2=0X00;
Delay(10);/*8*/
P1=0X40;
P2=0X00;
Delay(10);/*7*/
P1=0X20;
P2=0X00;
Delay(10);/*6*/
P1=0X10;
P2=0X00;
Delay(10);/*5*/
P1=0X8;
P2=0X00;
Delay(10);/*4*/
P1=0X4;
P2=0X00;
Delay(10);/*3*/
P1=0X2;
P2=0X00;
Delay(10);/*2*/
P1=0X1;
P2=0X00;
Delay(10);/*1*/
/****************************************列平面扫描*************************************/
P1=0XF;
P2=0X00;
Delay(20);/*1*/
P1=0XF0;
P2=0X00;
Delay(20);/*2*/
P1=0X00;
P2=0XF;
Delay(20);/*3*/
P1=0X00;
P2=0XF0;
Delay(20);/*4*/
P1=0X00;
P2=0XF;
Delay(20);/*3*/
P1=0XF0;
P2=0X00;
Delay(20);/*2*/
P1=0XF;
P2=0X00;
Delay(20);/*1*/
/**********************************层扫描****************************/
P0=0XFE;
P1=0XFF;
P2=0XFF;
Delay(20);/*第1层(从下到上)*/
P0=0XFD;
P1=0XFF;
P2=0XFF;
Delay(20);/*第2层(从下到上)*/
P0=0XFB;
P1=0XFF;
P2=0XFF;
Delay(20);/*第3层(从下到上)*/
P0=0XF7;
P1=0XFF;
P2=0XFF;
Delay(20);/*第4层(从下到上)*/
P0=0XFB;
P1=0XFF;
P2=0XFF;
Delay(20);/*第3层(从下到上)*/
P0=0XFD;
P1=0XFF;
P2=0XFF;
Delay(20);/*第2层(从下到上)*/
P0=0XFE;
P1=0XFF;
P2=0XFF;
Delay(20);/*第1层(从下到上)*/
/*&*******************************层平面完毕******************************/
/***************群体闪烁********************/
P0=0XF0;
P1=0X00;
P2=0X00;
Delay(10);
P1=0XFF;
P2=0XFF;
Delay(10);
P1=0X00;
P2=0X00;
Delay(10);
P1=0XFF;
P2=0XFF;
Delay(10);
P1=0X00;
P2=0X00;
Delay(10);
P1=0XFF;
P2=0XFF;
Delay(10);
/*********************************列连续扫描*******************************/
P0=0X00;
P1=0X1;
P2=0X00;
Delay(10);/*1*/
P1=0X2;
P2=0X00;
Delay(10);/*2*/
P1=0X4;
P2=0X00;
Delay(10);/*3*/
P1=0X8;
P2=0X00;
Delay(10);/*4*/
P1=0X80;
P2=0X00;
Delay(10);/*8*/
P1=0X40;
P2=0X00;
Delay(10);/*7*/
P1=0X20;
P2=0X00;
Delay(10);/*6*/
P1=0X10;
P2=0X00;
Delay(10);/*5*/
P1=0X00;
P2=0X1;
Delay(10);/*9*/
P1=0X00;
P2=0X2;
Delay(10);/*10*/
P1=0X00;
P2=0X4;
Delay(10);/*11*/
P1=0X00;
P2=0X8;
Delay(10);/*12*/
P1=0X00;
P2=0X80;
Delay(10);/*16*/
P1=0X00;
P2=0X40;
Delay(10);/*15*/
P1=0X00;
P2=0X20;
Delay(10);/*14*/
P1=0X00;
P2=0X10;
Delay(10);/*13(返回开始)*/
P1=0X00;
P2=0X20;
Delay(10);/*14*/
P1=0X00;
P2=0X40;
Delay(10);/*15*/
P1=0X00;
P2=0X80;
Delay(10);/*16*/
P1=0X00;
P2=0X8;
Delay(10);/*12*/
P1=0X00;
P2=0X4;
Delay(10);/*11*/
P1=0X00;
P2=0X2;
Delay(10);/*10*/
P1=0X00;
P2=0X1;
Delay(10);/*9*/
P1=0X10;
P2=0X00;
Delay(10);/*5*/
P1=0X20;
P2=0X00;
Delay(10);/*6*/
P1=0X40;
P2=0X00;
Delay(10);/*7*/
P1=0X80;
P2=0X00;
Delay(10);/*8*/
P1=0X8;
P2=0X00;
Delay(10);/*4*/
P1=0X4;
P2=0X00;
Delay(10);/*3*/
P1=0X2;
P2=0X00;
Delay(10);/*2*/
P1=0X1;
P2=0X00;
Delay(10);/********1(完毕)****************/
/*****************逐点走*****************/
P0=0XFE;
P1=0X1;
P2=0X00;
Delay(10);/*1*/
P0=0XFE;
P1=0X2;
P2=0X00;
Delay(10);/*2*/
P0=0XFE;
P1=0X4;
P2=0X00;
Delay(10);/*3*/
P0=0XFE;
P1=0X8;
P2=0X00;
Delay(10);/*4*/
P0=0XFE;
P1=0X10;
P2=0X00;
Delay(10);/*5*/
P0=0XFE;
P1=0X20;
P2=0X00;
Delay(10);/*6*/
P0=0XFE;
P1=0X40;
P2=0X00;
Delay(10);/*7*/
P0=0XFE;
P1=0X80;
P2=0X00;
Delay(10);/*8*/
P0=0XFE;
P1=0X00;
P2=0X1;
Delay(10);/*9*/
P0=0XFE;
P1=0X00;
P2=0X2;
Delay(10);/*10*/
P0=0XFE;
P1=0X00;
P2=0X4;
Delay(10);/*11*/
P0=0XFE;
P1=0X00;
P2=0X8;
Delay(10);/*12*/
P0=0XFE;
P1=0X00;
P2=0X10;
Delay(10);/*13*/
P0=0XFE;
P1=0X00;
P2=0X20;
Delay(10);/*14*/
P0=0XFE;
P1=0X00;
P2=0X40;
Delay(10);/*15*/
P0=0XFE;
P1=0X00;
P2=0X80;
Delay(10);/*16*/
/*****************正方形放大缩小*********************/
P0=0XFC;
P1=0X00;
P2=0XCC;
Delay(100);/*小正方形*/
P0=0XF8;
P1=0XE0;
P2=0XEE;/*放大一倍*/
Delay(100);
P0=0XF0;
P1=0XFF;
P2=0XFF;
Delay(100);/*再次放大(全亮)*/
P0=0XF8;
P1=0XE0;
P2=0XEE;/*放大一倍*/
Delay(100);
P0=0XFC;
P1=0X00;
P2=0XCC;/*小正方形*/
Delay(200);
/***************群体闪烁********************/
P0=0XF0;
P1=0X00;
P2=0X00;
Delay(10);
P1=0XFF;
P2=0XFF;
Delay(10);
P1=0X00;
P2=0X00;
Delay(10);
P1=0XFF;
P2=0XFF;
Delay(10);
P1=0X00;
P2=0X00;
Delay(10);
P1=0XFF;
P2=0XFF;
Delay(10);
/****************贪吃蛇******************/
P0=0XF7;
P1=0XE;
P2=0X80;
Delay(50);
P1=0X7;
P2=0X80;
Delay(50);
P1=0X13;
P2=0X80;
Delay(50);
P1=0X11;
P2=0X81;
Delay(50);
P1=0X10;
P2=0X91;
Delay(50);
P1=0X00;
P2=0XB1;
Delay(50);
P1=0X00;
P2=0XF0;
Delay(50);
}
|