欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
單片機跑馬燈實現
[打印本頁]
作者:
1067608727
時間:
2018-7-3 14:34
標題:
單片機跑馬燈實現
//#include <REG52.h>
#include <STC/STC89C5xRC.H>
void Delay(unsigned int i);
#define DP P1 //DataPort
unsigned char code RTL[9]={0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};
/**
* 1111 1111 1111 1110 -- 0000 0000
*/
unsigned char code LTR[9]={0xff,0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};
/**
* 1111 1111 0111 1111 -- 0000 0000
*/
unsigned char code L[2][5]={{0xff,0x7f,0x3f,0x1f,0x0f},{0x0f,0x8f,0xcf,0xef,0xff}};
/**
* 1111 1111 0111 1111 -- 0000 1111
* 0000 1111 1000 1111 -- 1111 1111
*/
unsigned char code R[2][5]={{0xff,0xfe,0xfc,0xf8,0xf0},{0xf0,0xf1,0xf3,0xf7,0xff}};
/**
* 1111 1111 1111 1110 -- 1111 0000
* 1111 0000 1111 0001 -- 1111 1111
*/
void main(){
int i,j;
while(1){
for(i=0;i<=8;i++){
DP=LTR[i];
Delay(100);
}
//Delay(1000);
for(i=8;i>=0;i--){
DP=RTL[i];
Delay(100);
}
//Delay(200);
for(i=0;i<=8;i++){
DP=RTL[i];
Delay(100);
}
//Delay(1000);
for(i=8;i>=0;i--){
DP=LTR[i];
Delay(100);
}
//Delay(200);
for(j=0;j<2;j++){
for(i=0;i<5;i++){
DP=L[j][i]&R[j][i];
Delay(100);
}
//Delay(200);
}
for(j=1;j>=0;j--){
for(i=4;i>=0;i--){
DP=L[j][i]&R[j][i];
Delay(100);
}
//Delay(200);
}
DP=0x00;
Delay(200);
DP=0xff;
Delay(100);
DP=0x00;
Delay(200);
DP=0xff;
Delay(100);
}
}
void Delay(unsigned int i){
unsigned int j;
for(;i>0;i--)
for(j=0;j<125;j++) ;
}
復制代碼
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1