#include<reg51.h> #define uchar unsigned char #define uint unsigned int
uchar code TABRED[]={0XDF,0XDF,0XDF,0XDF,0XDF,0XDF,0XDF,0XDF, 0X81,0XBF,0XBF,0X81,0XFD,0XFD,0XFD,0X81, 0X81,0XBF,0XBF,0X81,0XBF,0XBF,0XBF,0X81};
uchar i,t; delay(uchar t) { while(t--) {;} } void main(void) { uchar N,T; while(1) { for(N=0;N<3;N++) for(T=0;T<200;T++) { P2=0XFE; for(i=0;i<8;i++) { P3=TABRED[i+8*N]; delay(100); P2=(P2<<1)|(P2>>7); } } } }
#include<reg51.h> #define uchar unsigned char #define uint unsigned int
uchar code TABGREEN[]={0XDF,0XDF,0XDF,0XDF,0XDF,0XDF,0XDF,0XDF, 0X81,0XBF,0XBF,0X81,0XFD,0XFD,0XFD,0X81, 0X81,0XBF,0XBF,0X81,0XBF,0XBF,0XBF,0X81};
uchar i,t; delay(uchar t) { while(t--) {;} } void main(void) { uchar N,T; while(1) { for(N=0;N<3;N++) for(T=0;T<200;T++) { P2=0XFE; for(i=0;i<8;i++) { P0=TABGREEN[i+8*N]; delay(100); P2=(P2<<1)|(P2>>7); } } } } |