Kênh Tên Miền chuyên cung cấp tên miền đẹp, giá rẻ! Hãy liên hệ kỹ thuật: 0914205579 - Kinh doanh: 0912191357 để được tư vấn, hướng dẫn miễn phí, Cảm ơn quý khách đã ủng hộ trong thời gian qua!
Thursday, October 3, 2013


Chip nhìn thấy mấy video led sao băng trên Youtube chạy nhìn đẹp....có 1 code led sao băng 3 màu của bạn daohuytien ben DTVN nhưng chỉ có 24 led..chip ngồi hì hục viết lên 32 led được 5 hiệu ứng mà đã Full hơn 7k rồi..toàn setbit tốn bộ nhớ dã man...Bạn nào thích thì làm chơi cho vui.

Chân nối từ Vòng tròn  P1.0 - P1.7  Nối tiếp P3.0 - P3.7 Nối Tiếp P2.0 - P2.7 Nối P0.7 - P0.0


Code Compile By Keil C 4 nhé:
#include<regx52.h>
Editer By ChipKool_Online
sbit wt1=P0^7;// P0
sbit wt2=P0^6;
sbit wt3=P0^5;
sbit wt4=P0^4;
sbit wt5=P0^3;
sbit wt6=P0^2;
sbit wt7=P0^1;
sbit wt8=P0^0;

sbit w1=P1^0;// P1
sbit w2=P1^1;
sbit w3=P1^2;
sbit w4=P1^3;
sbit w5=P1^4;
sbit w6=P1^5;
sbit w7=P1^6;
sbit w8=P1^7;

sbit w21=P2^0; // P2
sbit w22=P2^1;
sbit w23=P2^2;
sbit w24=P2^3;
sbit w25=P2^4;
sbit w26=P2^5;
sbit w27=P2^6;
sbit w28=P2^7;

sbit w11=P3^0; // P3
sbit w12=P3^1;
sbit w13=P3^2;
sbit w14=P3^3;
sbit w15=P3^4;
sbit w16=P3^5;
sbit w17=P3^6;
sbit w18=P3^7;

unsigned char code a[8][64]=
{
 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,}
//1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
};
//-----------------------------------------------------
void delayus(int time)
{ // ham nay co do che la 20 us
int n;
unsigned char a;
for(n=0;n<time;n++)
{
a=0;
}
}
//-----------------------------------------------------
void delayus1()
{ // ham nay co do che la 20 us
unsigned char a,n;
for(n=0;n<10;n++)
{
a=0;
}
}
//-----------------------------------------------------
void saobang1vong()
{
int n,k,h;
for(k=0;k<33;k++)
{
for(n=1;n<14;n++)
{
for(h=0;h<8;h++)
{ P1=0xff;P2=0xff;P3=0xff;//wr=n1;wg=n2;wb=n3;
w1=a[h][k];w2=a[h][k+1];w3=a[h][k+2];w4=a[h][k+3];w5=a[h][k+4];w6=a[h][k+5];w7=a[h][k+6];w8=a[h][k+7]; //P1
w11=a[h][k+8];w12=a[h][k+9];w13=a[h][k+10];w14=a[h][k+11];w15=a[h][k+12];w16=a[h][k+13];w17=a[h][k+14];w18=a[h][k+15];//P3
w21=a[h][k+16];w22=a[h][k+17];w23=a[h][k+18];w24=a[h][k+19];w25=a[h][k+20];w26=a[h][k+21];w27=a[h][k+22];w28=a[h][k+23];//P2
wt1=a[h][k+24];wt2=a[h][k+25];wt3=a[h][k+26];wt4=a[h][k+27];wt5=a[h][k+28];wt6=a[h][k+29];wt7=a[h][k+30];wt8=a[h][k+31];//P0
delayus1();
}
}
}
}
//-----------------------------------------------------
void saobang2benduoilen()
{
int n,k,h;
for(k=15;k<33;k++)
{
for(n=1;n<20;n++)
{
for(h=0;h<8;h++)
{ P1=0xff;P2=0xff;P3=0xff;P0=0xff;//wr=n1;wg=n2;wb=n3;
w1=a[h][k]; // p3.7
w2=a[h][k+1];wt8=a[h][k+1]; // p3.6 - p2.0
w3=a[h][k+2];wt7=a[h][k+2];
w4=a[h][k+3];wt6=a[h][k+3];
w5=a[h][k+4];wt5=a[h][k+4];
w6=a[h][k+5];wt4=a[h][k+5];
w7=a[h][k+6];wt3=a[h][k+6];
w8=a[h][k+7];wt2=a[h][k+7];
w11=a[h][k+8];wt1=a[h][k+8];
w12=a[h][k+9];w28=a[h][k+9];
w13=a[h][k+10];w27=a[h][k+10];
w14=a[h][k+11];w26=a[h][k+11];
w15=a[h][k+12];w25=a[h][k+12];
w16=a[h][k+13];w24=a[h][k+13];
w17=a[h][k+14];w23=a[h][k+14];
w18=a[h][k+15];w22=a[h][k+15];
w21=a[h][k+16];
delayus1();

}
}
}
}
//-----------------------------------------------------
void saobang2bentrenxuong()
{
int n,k,h;
for(k=15;k<33;k++)
{
for(n=1;n<20;n++)
{
for(h=0;h<8;h++)
{ P1=0xff;P2=0xff;P3=0xff;P0=0xff;//wr=n1;wg=n2;wb=n3;
w21=a[h][k]; // p3.7
w22=a[h][k+1];w18=a[h][k+1]; // p3.6 - p2.0
w23=a[h][k+2];w17=a[h][k+2];
w24=a[h][k+3];w16=a[h][k+3];
w25=a[h][k+4];w15=a[h][k+4];
w26=a[h][k+5];w14=a[h][k+5];
w27=a[h][k+6];w13=a[h][k+6];
w28=a[h][k+7];w12=a[h][k+7];
wt1=a[h][k+8];w11=a[h][k+8];
wt2=a[h][k+9];w8=a[h][k+9];
wt3=a[h][k+10];w7=a[h][k+10];
wt4=a[h][k+11];w6=a[h][k+11];
wt5=a[h][k+12];w5=a[h][k+12];
wt6=a[h][k+13];w4=a[h][k+13];
wt7=a[h][k+14];w3=a[h][k+14];
wt8=a[h][k+15];w2=a[h][k+15];
w1=a[h][k+16];
delayus1();

}
}
}
}
//-----------------------------------------------------
void saobang2benxoaytrai()
{
int n,k,h;
for(k=15;k<33;k++)
{
for(n=1;n<20;n++)
{
for(h=0;h<8;h++)
{ P1=0xff;P2=0xff;P3=0xff;P0=0xff;//wr=n1;wg=n2;wb=n3;
w18=a[h][k]; // p3.7
w17=a[h][k+1];wt8=a[h][k+1]; // p3.6 - p2.0
w16=a[h][k+2];wt7=a[h][k+2];
w15=a[h][k+3];wt6=a[h][k+3];
w14=a[h][k+4];wt5=a[h][k+4];
w13=a[h][k+5];wt4=a[h][k+5];
w12=a[h][k+6];wt3=a[h][k+6];
w11=a[h][k+7];wt2=a[h][k+7];
w8=a[h][k+8];wt1=a[h][k+8];
w7=a[h][k+9];w28=a[h][k+9];
w6=a[h][k+10];w27=a[h][k+10];
w5=a[h][k+11];w26=a[h][k+11];
w4=a[h][k+12];w25=a[h][k+12];
w3=a[h][k+13];w24=a[h][k+13];
w2=a[h][k+14];w23=a[h][k+14];
w1=a[h][k+15];w22=a[h][k+15];
w21=a[h][k+16];
delayus1();

}
}
}
}
//-----------------------------------------------------
void saobang2benxoayphai()  // Test
{
int n,k,h;
for(k=15;k<33;k++)
{
for(n=1;n<20;n++)
{
for(h=0;h<8;h++)
{ P1=0xff;P2=0xff;P3=0xff;P0=0xff;//wr=n1;wg=n2;wb=n3;
//w18=a[h][k]; // p3.7
w2=a[h][k+1];w22=a[h][k+1]; // p3.6 - p2.0
w3=a[h][k+2];w23=a[h][k+2];
w4=a[h][k+3];w24=a[h][k+3];
w5=a[h][k+4];w25=a[h][k+4];
w6=a[h][k+5];w26=a[h][k+5];
w7=a[h][k+6];w27=a[h][k+6];
w8=a[h][k+7];w28=a[h][k+7];
w11=a[h][k+8];wt1=a[h][k+8];
w12=a[h][k+9];wt2=a[h][k+9];
w13=a[h][k+10];wt3=a[h][k+10];
w14=a[h][k+11];wt4=a[h][k+11];
w15=a[h][k+12];wt5=a[h][k+12];
w16=a[h][k+13];wt6=a[h][k+13];
w17=a[h][k+14];wt7=a[h][k+14];
w18=a[h][k+15];wt8=a[h][k+15];
w21=a[h][k+16];w1=a[h][k+16];
delayus1();

}
}
}
}
//-----------------------------------------------------
void main()
{ P0=0x00;P1=0x00;P2=0x00;P3=0x00;
while(1)
{

saobang1vong();
saobang2benduoilen();
saobang2bentrenxuong();
saobang2benxoaytrai();
saobang2benxoayphai();

}
}

( Mô Phỏng + Code C + Code Hex)
Khi nhấn nút "Tải Về Máy", bạn sẽ vào trang quảng cáo, vui lòng chờ 5 giây. Nút  hiện ra ở góc phải phía trên, nhấn vào để đến trang download



Có 1 bạn chia sẻ code Led sao băng 3 màu: Chip đọc khó hiểu lòi mắt....mà lại còn giấu giấu...Chán.. Bạn nào thích thì down về nhai..nấu..xào luộc thì tùy nhé..( không phải code chip viết)

http://www.mediafire.com/?jhvv2kyqjm6ngdj

Blog Điện Tử | Tin Học - Chia sẻ kiến thức - Kết nối đam mê điện tử

0 comments:

Post a Comment

domain, domain name, premium domain name for sales

Popular Posts