Nguyên văn bởi nhandientuvn
Thông báo
Collapse
No announcement yet.
[TUT] Lý thuyết về code LED sao băng bằng ASM và KeilC cho 8051
Collapse
This is a sticky topic.
X
X
-
/*Thach anh su dung f=24Mhz*/
#include "regx52.h"
typedef unsigned char uchar;
typedef unsigned int uint;
sbit led = P0^0;
uchar num_pwm;
uchar pwm_c;
uchar delay_in_t1;
void isr_timer1() interrupt 3 using 2{
TH1=0xFE; /* -24000000/12/60/100 ~= -333 ->0xfeb3 (100 nghia la 100 muc sang)*/
TL1=0xB3; /* chu ky ngat timer1 T=(333/2)us --> T*6 = 999 us ~= 1ms*/
led =(pwm_c>num_pwm)?1:0;
if(++num_pwm==100){
num_pwm=0;
}
++delay_in_t1;
}
void delay_ms(uchar time){
delay_in_t1 = 0;
while(delay_in_t1 <= time*6);
}
void led_dim_ti();
void main(){
TMOD=0x10; /*timer 1 16bit*/
TR1=1;
TH1=0xFE;
TL1=0xB3;
IE=0x88; /*Ket thuc khoi dong timer1*/
while(1){
led_dim_ti();
}
}
void led_dim_ti(){
uchar i;
P0 = 0;
while(1){
for(i=0;i<=100;i++){
pwm_c = i;
num_pwm = 0;
delay_ms(16);
}
for(i=0;i<=100;i++){
pwm_c = 100-i;
num_pwm = 0;
delay_ms(16);
}
}
}
Bác nào có thể giải thích giúp mình chi tiết hơn những code trên được không ak. Dùng delay thì mình hiểu, chứ ngắt đọc mãi chẳng hiểu được ý đồ từng dòng lệnh của bác chủ thớt..Last edited by caonhan_2004; 05-11-2013, 12:09.
Comment
-
[Phần cuối] Led sao băng trái tim
Trước tiên là sorry tất cả các bác vì sự vô cùng chậm trễ nầy . Giờ mình share code và cách làm led trái tim cho các bác nào còn FA nè chứ tui thì ổn định rùi hjhj.
Hình ảnh làm led.
Code full
Code:#include "regx52.h" #include "code_display_32c.h" #define t 15 typedef unsigned char uchar; typedef unsigned int uint; sbit c1=P0^0; sbit c2=P0^1; sbit c3=P0^2; sbit c4=P0^3; sbit c5=P0^4; sbit c6=P0^5; sbit c7=P0^6; sbit c8=P0^7; sbit c9=P2^7; sbit c10=P2^6; sbit c11=P2^5; sbit c12=P2^4; sbit c13=P2^3; sbit c14=P2^2; sbit c15=P2^1; sbit c16=P2^0; sbit c17=P3^7; sbit c18=P3^6; sbit c19=P3^5; sbit c20=P3^4; sbit c21=P3^3; sbit c22=P3^2; sbit c23=P3^1; sbit c24=P3^0; sbit c25=P1^7; sbit c26=P1^6; sbit c27=P1^5; sbit c28=P1^4; sbit c29=P1^3; sbit c30=P1^2; sbit c31=P1^1; sbit c32=P1^0; bit f_endl; uchar timedl; uchar settimedl; // | | | // c1,c2,c3|c4,c5,c6,c7,c8|c9,c10,c11,c12,c13,c14|c15 ,c16,c17, uchar code hu01[32]={14,13,12,11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,1, 0, 14,13, 12,11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1,0}; // | | | //c18,c19,c20|c21,c22,c23,c24,c25,c26|c27,c28,c29,c3 0,c31,c32| // | | | // c1,c2,c3|c4,c5,c6,c7,c8|c9,c10,c11,c12,c13,c14|c15 ,c16,c17, uchar code hu02[32]={14,13,12,11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,1, 0, 0,1, 1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,14}; // | | | //c18,c19,c20|c21,c22,c23,c24,c25,c26|c27,c28,c29,c3 0,c31,c32| // | | | // c1,c2,c3|c4,c5,c6,c7,c8|c9,c10,c11,c12,c13,c14|c15 ,c16,c17, uchar code hu03[32]={0,5,10,14, 0,5,10,14,0,5,10,14,0,5,10,14,0,5,10,14,0,5,10,14, 0,5,10,14,0,5,10,14}; // | | | //c18,c19,c20|c21,c22,c23,c24,c25,c26|c27,c28,c29,c3 0,c31,c32| // | | | // c1,c2,c3|c4,c5,c6,c7,c8|c9,c10,c11,c12,c13,c14|c15 ,c16,c17, uchar code hu04[32]={0,5,10,14, 0,5,10,14,0,5,10,14,0,5,10,14, 14,10,5,1, 14,10,5,1, 14,10,5,1, 14,10,5,1}; // | | | //c18,c19,c20|c21,c22,c23,c24,c25,c26|c27,c28,c29,c3 0,c31,c32| void isr_timer0() interrupt 1 using 1{ TH0=0xb1; TL0=0xe0; /*10ms*/ if(f_endl && ++timedl==settimedl){ timedl=0; f_endl=0; } } uchar num_pwm; uchar pwm_c[32]; void isr_timer1() interrupt 3 using 2{ TH1=0xf8; /*tan so dieu rong xung 24*10^6/12/66/15=2000-->f830 */ TL1=0x30; /*f=60hz*/ c1=(pwm_c[0]>num_pwm)?1:0; c2=(pwm_c[1]>num_pwm)?1:0; c3=(pwm_c[2]>num_pwm)?1:0; c4=(pwm_c[3]>num_pwm)?1:0; c5=(pwm_c[4]>num_pwm)?1:0; c6=(pwm_c[5]>num_pwm)?1:0; c7=(pwm_c[6]>num_pwm)?1:0; c8=(pwm_c[7]>num_pwm)?1:0; c9=(pwm_c[8]>num_pwm)?1:0; c10=(pwm_c[9]>num_pwm)?1:0; c11=(pwm_c[10]>num_pwm)?1:0; c12=(pwm_c[11]>num_pwm)?1:0; c13=(pwm_c[12]>num_pwm)?1:0; c14=(pwm_c[13]>num_pwm)?1:0; c15=(pwm_c[14]>num_pwm)?1:0; c16=(pwm_c[15]>num_pwm)?1:0; c17=(pwm_c[16]>num_pwm)?1:0; c18=(pwm_c[17]>num_pwm)?1:0; c19=(pwm_c[18]>num_pwm)?1:0; c20=(pwm_c[19]>num_pwm)?1:0; c21=(pwm_c[20]>num_pwm)?1:0; c22=(pwm_c[21]>num_pwm)?1:0; c23=(pwm_c[22]>num_pwm)?1:0; c24=(pwm_c[23]>num_pwm)?1:0; c25=(pwm_c[24]>num_pwm)?1:0; c26=(pwm_c[25]>num_pwm)?1:0; c27=(pwm_c[26]>num_pwm)?1:0; c28=(pwm_c[27]>num_pwm)?1:0; c29=(pwm_c[28]>num_pwm)?1:0; c30=(pwm_c[29]>num_pwm)?1:0; c31=(pwm_c[30]>num_pwm)?1:0; c32=(pwm_c[31]>num_pwm)?1:0; if(++num_pwm==15){ num_pwm=0; } } void delay_ms(uchar time){ TH0=0xb1; TL0=0xe0; /*10ms*/ settimedl=time; f_endl=1; while(f_endl); } void init_time0(); void init_time0_1(); void hieu_ung1(uchar dl); void hieu_ung2(uchar dl); void hieu_ung3(uchar dl); void hieu_ung4(uchar dl); void hieu_ung5(uchar dl); void hieu_ung6(uchar dl); void hieu_ung01(uchar dl); /*hieu ung song lon led tron*/ void hieu_ung02(uchar dl); /*hieu ung song lon led 2 ben*/ void hieu_ung03(uchar dl); /*hieu ung song 8 canh led tron*/ void hieu_ung07(uchar dl); /*hieu ung song 8 canh led tron nguoc*/ void hieu_ung04(uchar dl); /*hieu ung song 4canh led 2 ben*/ void hieu_ung08(uchar dl); /*hieu ung song 4canh led 2 ben nguoc*/ void hieu_ung05(uchar dl); /*hieu ung song lon led tron nguoc*/ void hieu_ung06(uchar dl); /*hieu ung song lon led 2 ben nguoc*/ void hieu_ung09(); /*hieu ung sang,tat dan*/ void main(){ P1=P2=P3=P0=0xff; init_time0(); while(1){ hieu_ung09(); hieu_ung1(3); hieu_ung2(1); hieu_ung3(10); hieu_ung4(1); hieu_ung5(10); hieu_ung6(1); hieu_ung09(); hieu_ung01(5); hieu_ung05(5); hieu_ung02(5); hieu_ung06(5); hieu_ung03(10); hieu_ung07(10); hieu_ung04(10); hieu_ung08(10); hieu_ung09(); hieu_ung01(1); hieu_ung05(1); hieu_ung01(1); hieu_ung05(1); hieu_ung01(1); hieu_ung05(1); hieu_ung01(1); hieu_ung05(1); hieu_ung4(1); hieu_ung02(1); hieu_ung06(1); hieu_ung02(1); hieu_ung06(1); hieu_ung02(1); hieu_ung06(1); hieu_ung02(1); hieu_ung06(1); hieu_ung02(1); hieu_ung06(1); hieu_ung09(); hieu_ung6(1); hieu_ung03(2); hieu_ung07(2); hieu_ung03(2); hieu_ung07(2); hieu_ung03(2); hieu_ung07(2); hieu_ung03(2); hieu_ung07(2); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung09(); hieu_ung2(2); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); } } void hieu_ung1(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display1[1];i++){ P0s=code_display1[code_display1[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display1[code_display1[2]*i+4]; P3=code_display1[code_display1[2]*i+5]; P1=code_display1[code_display1[2]*i+6]; delay_ms(t); } } } void hieu_ung2(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display2[1];i++){ P0s=code_display2[code_display2[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display2[code_display2[2]*i+4]; P3=code_display2[code_display2[2]*i+5]; P1=code_display2[code_display2[2]*i+6]; delay_ms(t); }} } void hieu_ung3(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display3[1];i++){ P0s=code_display3[code_display3[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display3[code_display3[2]*i+4]; P3=code_display3[code_display3[2]*i+5]; P1=code_display3[code_display3[2]*i+6]; delay_ms(t); }} } void hieu_ung4(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display4[1];i++){ P0s=code_display4[code_display4[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display4[code_display4[2]*i+4]; P3=code_display4[code_display4[2]*i+5]; P1=code_display4[code_display4[2]*i+6]; delay_ms(10); }} } void hieu_ung5(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display5[1];i++){ P0s=code_display5[code_display5[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display5[code_display5[2]*i+4]; P3=code_display5[code_display5[2]*i+5]; P1=code_display5[code_display5[2]*i+6]; delay_ms(t); }} } void hieu_ung6(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display6[1];i++){ P0s=code_display6[code_display6[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display6[code_display6[2]*i+4]; P3=code_display6[code_display6[2]*i+3]; P1=code_display6[code_display6[2]*i+4]; delay_ms(10); }} } void hieu_ung01(uchar dl){ /*hieu ung song lon led tron*/ uchar shu,i; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu01[i]; delay_ms(10); shu=hu01[31]; for(j=0;j<(dl*32);j++){ for(i=30;i!=255;i--) pwm_c[i+1]=pwm_c[i]; pwm_c[0]=shu; delay_ms(10); shu=pwm_c[31]; } } void hieu_ung02(uchar dl){ /*hieu ung song lon led 2 ben*/ uchar shu,shu1,i,k; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu02[i]; delay_ms(10); shu=hu02[31]; shu1=hu02[0]; for(j=0;j<(dl*16);j++){ for(i=30,k=0;i>15,k<16;i--,k++){ pwm_c[i+1]=pwm_c[i]; pwm_c[k]=pwm_c[k+1]; } pwm_c[16]=shu; pwm_c[15]=shu1; delay_ms(10); shu=pwm_c[31]; shu1=pwm_c[0]; } } void hieu_ung03(uchar dl){ /*hieu ung song 8 canh led tron*/ uchar shu,i; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu03[i]; delay_ms(10); shu=hu03[31]; for(j=0;j<(dl*4);j++){ for(i=30;i!=255;i--) pwm_c[i+1]=pwm_c[i]; pwm_c[0]=shu; delay_ms(10); shu=pwm_c[31]; } } void hieu_ung07(uchar dl){ /*hieu ung song 8 canh led tron nguoc*/ uchar shu,i; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu03[i]; delay_ms(10); shu=hu03[0]; for(j=0;j<(dl*4);j++){ for(i=0;i<31;i++) pwm_c[i]=pwm_c[i+1]; pwm_c[31]=shu; delay_ms(10); shu=pwm_c[0]; } } void hieu_ung04(uchar dl){ /*hieu ung song 4canh led 2 ben*/ uchar shu,shu1,i,k; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu04[i]; delay_ms(10); shu=hu04[31]; shu1=hu04[0]; for(j=0;j<(dl*4);j++){ for(i=30,k=0;i>15,k<15;i--,k++){ pwm_c[i+1]=pwm_c[i]; pwm_c[k]=pwm_c[k+1]; } pwm_c[16]=shu; pwm_c[15]=shu1; delay_ms(10); shu=pwm_c[31]; shu1=pwm_c[0]; } } void hieu_ung08(uchar dl){ /*hieu ung song 4canh led 2 ben nguoc*/ uchar shu,shu1,i,k; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu04[i]; delay_ms(10); shu=hu04[16]; shu1=hu04[15]; for(j=0;j<(dl*4);j++){ for(i=16,k=15;i<31,k>0;i++,k--){ pwm_c[i]=pwm_c[i+1]; pwm_c[k]=pwm_c[k-1]; } pwm_c[31]=shu; pwm_c[0]=shu1; delay_ms(10); shu=pwm_c[16]; shu1=pwm_c[15]; } } void hieu_ung05(uchar dl){ /*hieu ung song lon led tron nguoc*/ uchar shu,i; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu01[i]; delay_ms(10); shu=hu01[0]; for(j=0;j<(dl*32);j++){ for(i=0;i<31;i++) pwm_c[i]=pwm_c[i+1]; pwm_c[31]=shu; delay_ms(10); shu=pwm_c[0]; } } void hieu_ung06(uchar dl){ /*hieu ung song lon led 2 ben nguoc*/ uchar shu,shu1,i,k; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu02[i]; delay_ms(10); shu=hu02[16]; shu1=hu02[15]; for(j=0;j<(dl*16);j++){ for(i=16,k=15;i<31,k>0;i++,k--){ pwm_c[i]=pwm_c[i+1]; pwm_c[k]=pwm_c[k-1]; } pwm_c[31]=shu; pwm_c[0]=shu1; delay_ms(10); shu=pwm_c[16]; shu1=pwm_c[15]; } } void hieu_ung09(){ //sang dan, tat dan uchar i,j; init_time0_1(); P1=0xff; P3=0xff; for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(5); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(10); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(5); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(10); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(5); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(5); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(5); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(10); } } void init_time0(){ TMOD=0x01; /*timer 0 16bit*/ TR0=1; TH0=0xb1; TL0=0xe0; TF0=1; IE=0x82; } void init_time0_1(){ TMOD=0x11; /*timer 1 16bit*/ TR1=1; TH1=0xf8; TL1=0x30; TF1=1; IE=0x8a; }
Code:unsigned char code code_display1[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text :D:\led sign\led trai tim 32c\1.bmpLCD Font Maker ; Width x Height (pixels) :32X18 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/72Byte ; Font make date : 3/9/2011 12:12:35 AM ------------------------------------------------------------------------------*/ 0x20,0x12,0x04,//Width pixels,Height pixels,Width bytes 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x03,0xC0,0x00, 0x00,0x07,0xE0,0x00,0x00,0x0F, 0xF0,0x00,0x00,0x1F,0xF8,0x00,0x00,0x3F,0xFC,0x00, 0x00,0x7F,0xFE,0x00,0x00,0xFF, 0xFF,0x00,0x01,0xFF,0xFF,0x80,0x03,0xFF,0xFF,0xC0, 0x07,0xFF,0xFF,0xE0,0x0F,0xFF, 0xFF,0xF0,0x1F,0xFF,0xFF,0xF8,0x3F,0xFF,0xFF,0xFC, 0x7F,0xFF,0xFF,0xFE,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, }; unsigned char code code_display2[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text :D:\led sign\led trai tim 32c\1.bmpLCD Font Maker ; Width x Height (pixels) :32X17 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/68Byte ; Font make date : 3/9/2011 12:16:57 AM ------------------------------------------------------------------------------*/ 0x20,0x11,0x04,//Width pixels,Height pixels,Width bytes 0xFF,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFC,0x3F,0xFF, 0xFF,0xF8,0x1F,0xFF,0xFF,0xF0, 0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x03,0xFF, 0xFF,0x80,0x01,0xFF,0xFF,0x00, 0x00,0xFF,0xFE,0x00,0x00,0x7F,0xFC,0x00,0x00,0x3F, 0xF8,0x00,0x00,0x1F,0xF0,0x00, 0x00,0x0F,0xE0,0x00,0x00,0x07,0xC0,0x00,0x00,0x03, 0x80,0x00,0x00,0x01,0x00,0x00, 0x00,0x00,0x00,0x00, }; /* */ unsigned char code code_display3[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text : ; Width x Height (pixels) :32X4 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/16Byte ; Font make date : 3/8/2011 10:56:29 PM ------------------------------------------------------------------------------*/ 0x20,0x04,0x04,//Width pixels,Height pixels,Width bytes 0x88,0x88,0x88,0x88,0x44,0x44,0x44,0x44,0x22,0x22, 0x22,0x22,0x11,0x11,0x11,0x11, }; /* D:\led sign\led trai tim 32c\2.bmp */ unsigned char code code_display4[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text :D:\led sign\led trai tim 32c\22.bmp ; Width x Height (pixels) :32X153 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/612Byte ; Font make date : 3/9/2011 12:37:23 AM ------------------------------------------------------------------------------*/ 0x20,0x99,0x04,//Width pixels,Height pixels,Width bytes 0xFF,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFD,0xBF,0xFF, 0xFF,0xFB,0xDF,0xFF,0xFF,0xF7, 0xEF,0xFF,0xFF,0xEF,0xF7,0xFF,0xFF,0xDF,0xFB,0xFF, 0xFF,0xBF,0xFD,0xFF,0xFF,0x7F, 0xFE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x00, 0x01,0xFB,0xDF,0x00,0x01,0xF7, 0xEF,0x00,0x01,0xEF,0xF7,0x00,0x01,0xDF,0xFB,0x00, 0x01,0xBF,0xFD,0x00,0x01,0x7F, 0xFE,0x00,0x00,0xFF,0xFE,0x00,0x00,0xFE,0x7E,0x00, 0x00,0xFD,0xBE,0x00,0x00,0xFB, 0xDE,0x00,0x00,0xF7,0xEE,0x00,0x00,0xEF,0xF6,0x00, 0x00,0xDF,0xFA,0x00,0x00,0xBF, 0xFC,0x00,0x00,0x7F,0xFC,0x00,0x00,0x7E,0x7C,0x00, 0x00,0x7D,0xBC,0x00,0x00,0x7B, 0xDC,0x00,0x00,0x77,0xEC,0x00,0x00,0x6F,0xF4,0x00, 0x00,0x5F,0xF8,0x00,0x00,0x3F, 0xF8,0x00,0x00,0x3E,0x78,0x00,0x00,0x3D,0xB8,0x00, 0x00,0x3B,0xD8,0x00,0x00,0x37, 0xE8,0x00,0x00,0x2F,0xF0,0x00,0x00,0x1F,0xF0,0x00, 0x00,0x1E,0x70,0x00,0x00,0x1D, 0xB0,0x00,0x00,0x1B,0xD0,0x00,0x00,0x17,0xE0,0x00, 0x00,0x0F,0xE0,0x00,0x00,0x0E, 0x60,0x00,0x00,0x0D,0xA0,0x00,0x00,0x0B,0xC0,0x00, 0x00,0x07,0xC0,0x00,0x00,0x06, 0x40,0x00,0x00,0x05,0x80,0x00,0x00,0x03,0x80,0x00, 0x00,0x02,0x00,0x00,0x00,0x01, 0x00,0x00,0x00,0x00, }; /* */ unsigned char code code_display5[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text : ; Width x Height (pixels) :32X4 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/16Byte ; Font make date : 3/8/2011 10:55:48 PM ------------------------------------------------------------------------------*/ 0x20,0x04,0x04,//Width pixels,Height pixels,Width bytes 0x77,0x77,0x77,0x77,0xBB,0xBB,0xBB,0xBB,0xDD,0xDD, 0xDD,0xDD,0xEE,0xEE,0xEE,0xEE, }; /* D:\led sign\led trai tim 32c\22.bmp */ unsigned char code code_display6[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text :D:\led sign\led trai tim 32c\6.bmp ; Width x Height (pixels) :16X136 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/272Byte ; Font make date : 3/9/2011 1:13:54 AM ------------------------------------------------------------------------------*/ 0x10,0x88,0x02,//Width pixels,Height pixels,Width bytes 0x7F,0xFF,0xBF,0xFF,0xDF,0xFF,0xEF,0xFF,0xF7,0xFF, 0xFB,0xFF,0xFD,0xFF,0xFE,0xFF, 0xFF,0x7F,0xFF,0xBF,0xFF,0xDF,0xFF,0xEF,0xFF,0xF7, 0xFF,0xFB,0xFF,0xFD,0xFF,0xFE, 0x7F,0xFE,0xBF,0xFE,0xDF,0xFE,0xEF,0xFE,0xF7,0xFE, 0xFB,0xFE,0xFD,0xFE,0xFE,0xFE, 0xFF,0x7E,0xFF,0xBE,0xFF,0xDE,0xFF,0xEE,0xFF,0xF6, 0xFF,0xFA,0xFF,0xFC,0x7F,0xFC, 0xBF,0xFC,0xDF,0xFC,0xEF,0xFC,0xF7,0xFC,0xFB,0xFC, 0xFD,0xFC,0xFE,0xFC,0xFF,0x7C, 0xFF,0xBC,0xFF,0xDC,0xFF,0xEC,0xFF,0xF4,0xFF,0xF8, 0x7F,0xF8,0xBF,0xF8,0xDF,0xF8, 0xEF,0xF8,0xF7,0xF8,0xFB,0xF8,0xFD,0xF8,0xFE,0xF8, 0xFF,0x78,0xFF,0xB8,0xFF,0xD8, 0xFF,0xE8,0xFF,0xF0,0x7F,0xF0,0xBF,0xF0,0xDF,0xF0, 0xEF,0xF0,0xF7,0xF0,0xFB,0xF0, 0xFD,0xF0,0xFE,0xF0,0xFF,0x70,0xFF,0xB0,0xFF,0xD0, 0xFF,0xE0,0x7F,0xE0,0xBF,0xE0, 0xDF,0xE0,0xEF,0xE0,0xF7,0xE0,0xFB,0xE0,0xFD,0xE0, 0xFE,0xE0,0xFF,0x60,0xFF,0xA0, 0xFF,0xC0,0x7F,0xC0,0xBF,0xC0,0xDF,0xC0,0xEF,0xC0, 0xF7,0xC0,0xFB,0xC0,0xFD,0xC0, 0xFE,0xC0,0xFF,0x40,0xFF,0x80,0x7F,0x80,0xBF,0x80, 0xDF,0x80,0xEF,0x80,0xF7,0x80, 0xFB,0x80,0xFD,0x80,0xFE,0x80,0xFF,0x00,0x7F,0x00, 0xBF,0x00,0xDF,0x00,0xEF,0x00, 0xF7,0x00,0xFB,0x00,0xFD,0x00,0xFE,0x00,0x7E,0x00, 0xBE,0x00,0xDE,0x00,0xEE,0x00, 0xF6,0x00,0xFA,0x00,0xFC,0x00,0x7C,0x00,0xBC,0x00, 0xDC,0x00,0xEC,0x00,0xF4,0x00, 0xF8,0x00,0x78,0x00,0xB8,0x00,0xD8,0x00,0xE8,0x00, 0xF0,0x00,0x70,0x00,0xB0,0x00, 0xD0,0x00,0xE0,0x00,0x60,0x00,0xA0,0x00,0xC0,0x00, 0x40,0x00,0x80,0x00,0x00,0x00, };
Link video tham khảo thêm tương tự nè. https://www.youtube.com/watch?v=PfU3KO658IU
Code làm theo là chạy, ai làm rồi up cái video lên youtube xem với nha.
Còn ai muốn hiểu code thì chịu ngâm cứu từ đầu và suy nghĩ tí chứ đừng hỏi tại sao và tại sao nha.
Còn nợ các bác cái code ASM, hy vọng sẽ có trong năm mới này. Hoặc ai giúp cái, tui sẽ hỗ trợ chỉnh sửa cho!
Email:
Tel: 0983.497.310
Comment
-
Nguyên văn bởi tienhuypro Xem bài viếtTrước tiên là sorry tất cả các bác vì sự vô cùng chậm trễ nầy . Giờ mình share code và cách làm led trái tim cho các bác nào còn FA nè chứ tui thì ổn định rùi hjhj.
Hình ảnh làm led.
[ATTACH]81734[/ATTACH]
[ATTACH]81735[/ATTACH]
[ATTACH]81736[/ATTACH]
Code full
Code:#include "regx52.h" #include "code_display_32c.h" #define t 15 typedef unsigned char uchar; typedef unsigned int uint; sbit c1=P0^0; sbit c2=P0^1; sbit c3=P0^2; sbit c4=P0^3; sbit c5=P0^4; sbit c6=P0^5; sbit c7=P0^6; sbit c8=P0^7; sbit c9=P2^7; sbit c10=P2^6; sbit c11=P2^5; sbit c12=P2^4; sbit c13=P2^3; sbit c14=P2^2; sbit c15=P2^1; sbit c16=P2^0; sbit c17=P3^7; sbit c18=P3^6; sbit c19=P3^5; sbit c20=P3^4; sbit c21=P3^3; sbit c22=P3^2; sbit c23=P3^1; sbit c24=P3^0; sbit c25=P1^7; sbit c26=P1^6; sbit c27=P1^5; sbit c28=P1^4; sbit c29=P1^3; sbit c30=P1^2; sbit c31=P1^1; sbit c32=P1^0; bit f_endl; uchar timedl; uchar settimedl; // | | | // c1,c2,c3|c4,c5,c6,c7,c8|c9,c10,c11,c12,c13,c14|c15 ,c16,c17, uchar code hu01[32]={14,13,12,11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,1, 0, 14,13, 12,11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1,0}; // | | | //c18,c19,c20|c21,c22,c23,c24,c25,c26|c27,c28,c29,c3 0,c31,c32| // | | | // c1,c2,c3|c4,c5,c6,c7,c8|c9,c10,c11,c12,c13,c14|c15 ,c16,c17, uchar code hu02[32]={14,13,12,11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,1, 0, 0,1, 1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,14}; // | | | //c18,c19,c20|c21,c22,c23,c24,c25,c26|c27,c28,c29,c3 0,c31,c32| // | | | // c1,c2,c3|c4,c5,c6,c7,c8|c9,c10,c11,c12,c13,c14|c15 ,c16,c17, uchar code hu03[32]={0,5,10,14, 0,5,10,14,0,5,10,14,0,5,10,14,0,5,10,14,0,5,10,14, 0,5,10,14,0,5,10,14}; // | | | //c18,c19,c20|c21,c22,c23,c24,c25,c26|c27,c28,c29,c3 0,c31,c32| // | | | // c1,c2,c3|c4,c5,c6,c7,c8|c9,c10,c11,c12,c13,c14|c15 ,c16,c17, uchar code hu04[32]={0,5,10,14, 0,5,10,14,0,5,10,14,0,5,10,14, 14,10,5,1, 14,10,5,1, 14,10,5,1, 14,10,5,1}; // | | | //c18,c19,c20|c21,c22,c23,c24,c25,c26|c27,c28,c29,c3 0,c31,c32| void isr_timer0() interrupt 1 using 1{ TH0=0xb1; TL0=0xe0; /*10ms*/ if(f_endl && ++timedl==settimedl){ timedl=0; f_endl=0; } } uchar num_pwm; uchar pwm_c[32]; void isr_timer1() interrupt 3 using 2{ TH1=0xf8; /*tan so dieu rong xung 24*10^6/12/66/15=2000-->f830 */ TL1=0x30; /*f=60hz*/ c1=(pwm_c[0]>num_pwm)?1:0; c2=(pwm_c[1]>num_pwm)?1:0; c3=(pwm_c[2]>num_pwm)?1:0; c4=(pwm_c[3]>num_pwm)?1:0; c5=(pwm_c[4]>num_pwm)?1:0; c6=(pwm_c[5]>num_pwm)?1:0; c7=(pwm_c[6]>num_pwm)?1:0; c8=(pwm_c[7]>num_pwm)?1:0; c9=(pwm_c[8]>num_pwm)?1:0; c10=(pwm_c[9]>num_pwm)?1:0; c11=(pwm_c[10]>num_pwm)?1:0; c12=(pwm_c[11]>num_pwm)?1:0; c13=(pwm_c[12]>num_pwm)?1:0; c14=(pwm_c[13]>num_pwm)?1:0; c15=(pwm_c[14]>num_pwm)?1:0; c16=(pwm_c[15]>num_pwm)?1:0; c17=(pwm_c[16]>num_pwm)?1:0; c18=(pwm_c[17]>num_pwm)?1:0; c19=(pwm_c[18]>num_pwm)?1:0; c20=(pwm_c[19]>num_pwm)?1:0; c21=(pwm_c[20]>num_pwm)?1:0; c22=(pwm_c[21]>num_pwm)?1:0; c23=(pwm_c[22]>num_pwm)?1:0; c24=(pwm_c[23]>num_pwm)?1:0; c25=(pwm_c[24]>num_pwm)?1:0; c26=(pwm_c[25]>num_pwm)?1:0; c27=(pwm_c[26]>num_pwm)?1:0; c28=(pwm_c[27]>num_pwm)?1:0; c29=(pwm_c[28]>num_pwm)?1:0; c30=(pwm_c[29]>num_pwm)?1:0; c31=(pwm_c[30]>num_pwm)?1:0; c32=(pwm_c[31]>num_pwm)?1:0; if(++num_pwm==15){ num_pwm=0; } } void delay_ms(uchar time){ TH0=0xb1; TL0=0xe0; /*10ms*/ settimedl=time; f_endl=1; while(f_endl); } void init_time0(); void init_time0_1(); void hieu_ung1(uchar dl); void hieu_ung2(uchar dl); void hieu_ung3(uchar dl); void hieu_ung4(uchar dl); void hieu_ung5(uchar dl); void hieu_ung6(uchar dl); void hieu_ung01(uchar dl); /*hieu ung song lon led tron*/ void hieu_ung02(uchar dl); /*hieu ung song lon led 2 ben*/ void hieu_ung03(uchar dl); /*hieu ung song 8 canh led tron*/ void hieu_ung07(uchar dl); /*hieu ung song 8 canh led tron nguoc*/ void hieu_ung04(uchar dl); /*hieu ung song 4canh led 2 ben*/ void hieu_ung08(uchar dl); /*hieu ung song 4canh led 2 ben nguoc*/ void hieu_ung05(uchar dl); /*hieu ung song lon led tron nguoc*/ void hieu_ung06(uchar dl); /*hieu ung song lon led 2 ben nguoc*/ void hieu_ung09(); /*hieu ung sang,tat dan*/ void main(){ P1=P2=P3=P0=0xff; init_time0(); while(1){ hieu_ung09(); hieu_ung1(3); hieu_ung2(1); hieu_ung3(10); hieu_ung4(1); hieu_ung5(10); hieu_ung6(1); hieu_ung09(); hieu_ung01(5); hieu_ung05(5); hieu_ung02(5); hieu_ung06(5); hieu_ung03(10); hieu_ung07(10); hieu_ung04(10); hieu_ung08(10); hieu_ung09(); hieu_ung01(1); hieu_ung05(1); hieu_ung01(1); hieu_ung05(1); hieu_ung01(1); hieu_ung05(1); hieu_ung01(1); hieu_ung05(1); hieu_ung4(1); hieu_ung02(1); hieu_ung06(1); hieu_ung02(1); hieu_ung06(1); hieu_ung02(1); hieu_ung06(1); hieu_ung02(1); hieu_ung06(1); hieu_ung02(1); hieu_ung06(1); hieu_ung09(); hieu_ung6(1); hieu_ung03(2); hieu_ung07(2); hieu_ung03(2); hieu_ung07(2); hieu_ung03(2); hieu_ung07(2); hieu_ung03(2); hieu_ung07(2); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung3(1); hieu_ung5(1); hieu_ung09(); hieu_ung2(2); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); hieu_ung04(1); hieu_ung08(1); } } void hieu_ung1(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display1[1];i++){ P0s=code_display1[code_display1[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display1[code_display1[2]*i+4]; P3=code_display1[code_display1[2]*i+5]; P1=code_display1[code_display1[2]*i+6]; delay_ms(t); } } } void hieu_ung2(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display2[1];i++){ P0s=code_display2[code_display2[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display2[code_display2[2]*i+4]; P3=code_display2[code_display2[2]*i+5]; P1=code_display2[code_display2[2]*i+6]; delay_ms(t); }} } void hieu_ung3(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display3[1];i++){ P0s=code_display3[code_display3[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display3[code_display3[2]*i+4]; P3=code_display3[code_display3[2]*i+5]; P1=code_display3[code_display3[2]*i+6]; delay_ms(t); }} } void hieu_ung4(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display4[1];i++){ P0s=code_display4[code_display4[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display4[code_display4[2]*i+4]; P3=code_display4[code_display4[2]*i+5]; P1=code_display4[code_display4[2]*i+6]; delay_ms(10); }} } void hieu_ung5(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display5[1];i++){ P0s=code_display5[code_display5[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display5[code_display5[2]*i+4]; P3=code_display5[code_display5[2]*i+5]; P1=code_display5[code_display5[2]*i+6]; delay_ms(t); }} } void hieu_ung6(uchar dl){ uchar i,j,P0s; init_time0(); for(j=0;j<dl;j++){ for(i=0;i<code_display6[1];i++){ P0s=code_display6[code_display6[2]*i+3]; P0s=(P0s & 0x80)>>7 | (P0s & 0x40)>>5 | (P0s & 0x20)>>3 | (P0s & 0x10)>>1 | (P0s & 0x08)<<1 | (P0s & 0x04)<<3 | (P0s & 0x02)<<5 | (P0s & 0x01)<<7 ; P0=P0s; P2=code_display6[code_display6[2]*i+4]; P3=code_display6[code_display6[2]*i+3]; P1=code_display6[code_display6[2]*i+4]; delay_ms(10); }} } void hieu_ung01(uchar dl){ /*hieu ung song lon led tron*/ uchar shu,i; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu01[i]; delay_ms(10); shu=hu01[31]; for(j=0;j<(dl*32);j++){ for(i=30;i!=255;i--) pwm_c[i+1]=pwm_c[i]; pwm_c[0]=shu; delay_ms(10); shu=pwm_c[31]; } } void hieu_ung02(uchar dl){ /*hieu ung song lon led 2 ben*/ uchar shu,shu1,i,k; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu02[i]; delay_ms(10); shu=hu02[31]; shu1=hu02[0]; for(j=0;j<(dl*16);j++){ for(i=30,k=0;i>15,k<16;i--,k++){ pwm_c[i+1]=pwm_c[i]; pwm_c[k]=pwm_c[k+1]; } pwm_c[16]=shu; pwm_c[15]=shu1; delay_ms(10); shu=pwm_c[31]; shu1=pwm_c[0]; } } void hieu_ung03(uchar dl){ /*hieu ung song 8 canh led tron*/ uchar shu,i; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu03[i]; delay_ms(10); shu=hu03[31]; for(j=0;j<(dl*4);j++){ for(i=30;i!=255;i--) pwm_c[i+1]=pwm_c[i]; pwm_c[0]=shu; delay_ms(10); shu=pwm_c[31]; } } void hieu_ung07(uchar dl){ /*hieu ung song 8 canh led tron nguoc*/ uchar shu,i; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu03[i]; delay_ms(10); shu=hu03[0]; for(j=0;j<(dl*4);j++){ for(i=0;i<31;i++) pwm_c[i]=pwm_c[i+1]; pwm_c[31]=shu; delay_ms(10); shu=pwm_c[0]; } } void hieu_ung04(uchar dl){ /*hieu ung song 4canh led 2 ben*/ uchar shu,shu1,i,k; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu04[i]; delay_ms(10); shu=hu04[31]; shu1=hu04[0]; for(j=0;j<(dl*4);j++){ for(i=30,k=0;i>15,k<15;i--,k++){ pwm_c[i+1]=pwm_c[i]; pwm_c[k]=pwm_c[k+1]; } pwm_c[16]=shu; pwm_c[15]=shu1; delay_ms(10); shu=pwm_c[31]; shu1=pwm_c[0]; } } void hieu_ung08(uchar dl){ /*hieu ung song 4canh led 2 ben nguoc*/ uchar shu,shu1,i,k; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu04[i]; delay_ms(10); shu=hu04[16]; shu1=hu04[15]; for(j=0;j<(dl*4);j++){ for(i=16,k=15;i<31,k>0;i++,k--){ pwm_c[i]=pwm_c[i+1]; pwm_c[k]=pwm_c[k-1]; } pwm_c[31]=shu; pwm_c[0]=shu1; delay_ms(10); shu=pwm_c[16]; shu1=pwm_c[15]; } } void hieu_ung05(uchar dl){ /*hieu ung song lon led tron nguoc*/ uchar shu,i; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu01[i]; delay_ms(10); shu=hu01[0]; for(j=0;j<(dl*32);j++){ for(i=0;i<31;i++) pwm_c[i]=pwm_c[i+1]; pwm_c[31]=shu; delay_ms(10); shu=pwm_c[0]; } } void hieu_ung06(uchar dl){ /*hieu ung song lon led 2 ben nguoc*/ uchar shu,shu1,i,k; uint j; init_time0_1(); for(i=0;i<32;i++) pwm_c[i]=hu02[i]; delay_ms(10); shu=hu02[16]; shu1=hu02[15]; for(j=0;j<(dl*16);j++){ for(i=16,k=15;i<31,k>0;i++,k--){ pwm_c[i]=pwm_c[i+1]; pwm_c[k]=pwm_c[k-1]; } pwm_c[31]=shu; pwm_c[0]=shu1; delay_ms(10); shu=pwm_c[16]; shu1=pwm_c[15]; } } void hieu_ung09(){ //sang dan, tat dan uchar i,j; init_time0_1(); P1=0xff; P3=0xff; for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(5); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(10); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(5); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(10); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(5); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(1); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(2); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(5); } for(j=15;j!=255;j--){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(5); } for(j=0;j<16;j++){ for(i=0;i<32;i++) pwm_c[i]=j; delay_ms(10); } } void init_time0(){ TMOD=0x01; /*timer 0 16bit*/ TR0=1; TH0=0xb1; TL0=0xe0; TF0=1; IE=0x82; } void init_time0_1(){ TMOD=0x11; /*timer 1 16bit*/ TR1=1; TH1=0xf8; TL1=0x30; TF1=1; IE=0x8a; }
Code:unsigned char code code_display1[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text :D:\led sign\led trai tim 32c\1.bmpLCD Font Maker ; Width x Height (pixels) :32X18 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/72Byte ; Font make date : 3/9/2011 12:12:35 AM ------------------------------------------------------------------------------*/ 0x20,0x12,0x04,//Width pixels,Height pixels,Width bytes 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x03,0xC0,0x00, 0x00,0x07,0xE0,0x00,0x00,0x0F, 0xF0,0x00,0x00,0x1F,0xF8,0x00,0x00,0x3F,0xFC,0x00, 0x00,0x7F,0xFE,0x00,0x00,0xFF, 0xFF,0x00,0x01,0xFF,0xFF,0x80,0x03,0xFF,0xFF,0xC0, 0x07,0xFF,0xFF,0xE0,0x0F,0xFF, 0xFF,0xF0,0x1F,0xFF,0xFF,0xF8,0x3F,0xFF,0xFF,0xFC, 0x7F,0xFF,0xFF,0xFE,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, }; unsigned char code code_display2[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text :D:\led sign\led trai tim 32c\1.bmpLCD Font Maker ; Width x Height (pixels) :32X17 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/68Byte ; Font make date : 3/9/2011 12:16:57 AM ------------------------------------------------------------------------------*/ 0x20,0x11,0x04,//Width pixels,Height pixels,Width bytes 0xFF,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFC,0x3F,0xFF, 0xFF,0xF8,0x1F,0xFF,0xFF,0xF0, 0x0F,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xC0,0x03,0xFF, 0xFF,0x80,0x01,0xFF,0xFF,0x00, 0x00,0xFF,0xFE,0x00,0x00,0x7F,0xFC,0x00,0x00,0x3F, 0xF8,0x00,0x00,0x1F,0xF0,0x00, 0x00,0x0F,0xE0,0x00,0x00,0x07,0xC0,0x00,0x00,0x03, 0x80,0x00,0x00,0x01,0x00,0x00, 0x00,0x00,0x00,0x00, }; /* */ unsigned char code code_display3[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text : ; Width x Height (pixels) :32X4 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/16Byte ; Font make date : 3/8/2011 10:56:29 PM ------------------------------------------------------------------------------*/ 0x20,0x04,0x04,//Width pixels,Height pixels,Width bytes 0x88,0x88,0x88,0x88,0x44,0x44,0x44,0x44,0x22,0x22, 0x22,0x22,0x11,0x11,0x11,0x11, }; /* D:\led sign\led trai tim 32c\2.bmp */ unsigned char code code_display4[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text :D:\led sign\led trai tim 32c\22.bmp ; Width x Height (pixels) :32X153 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/612Byte ; Font make date : 3/9/2011 12:37:23 AM ------------------------------------------------------------------------------*/ 0x20,0x99,0x04,//Width pixels,Height pixels,Width bytes 0xFF,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFD,0xBF,0xFF, 0xFF,0xFB,0xDF,0xFF,0xFF,0xF7, 0x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x7F,0xFE,0x80, 0x02,0xFF,0xFF,0x00,0x01,0xFF, 0xFF,0x00,0x01,0xFE,0x7F,0x00,0x01,0xFD,0xBF,0x00, 0x01,0xFB,0xDF,0x00,0x01,0xF7, 0xEF,0x00,0x01,0xEF,0xF7,0x00,0x01,0xDF,0xFB,0x00, 0x01,0xBF,0xFD,0x00,0x01,0x7F, 0xFE,0x00,0x00,0xFF,0xFE,0x00,0x00,0xFE,0x7E,0x00, 0x00,0xFD,0xBE,0x00,0x00,0xFB, 0xDE,0x00,0x00,0xF7,0xEE,0x00,0x00,0xEF,0xF6,0x00, 0x00,0xDF,0xFA,0x00,0x00,0xBF, 0xFC,0x00,0x00,0x7F,0xFC,0x00,0x00,0x7E,0x7C,0x00, 0x00,0x7D,0xBC,0x00,0x00,0x7B, 0xDC,0x00,0x00,0x77,0xEC,0x00,0x00,0x6F,0xF4,0x00, 0x00,0x5F,0xF8,0x00,0x00,0x3F, 0xF8,0x00,0x00,0x3E,0x78,0x00,0x00,0x3D,0xB8,0x00, 0x00,0x3B,0xD8,0x00,0x00,0x37, 0xE8,0x00,0x00,0x2F,0xF0,0x00,0x00,0x1F,0xF0,0x00, 0x00,0x1E,0x70,0x00,0x00,0x1D, 0xB0,0x00,0x00,0x1B,0xD0,0x00,0x00,0x17,0xE0,0x00, 0x00,0x0F,0xE0,0x00,0x00,0x0E, 0x60,0x00,0x00,0x0D,0xA0,0x00,0x00,0x0B,0xC0,0x00, 0x00,0x07,0xC0,0x00,0x00,0x06, 0x40,0x00,0x00,0x05,0x80,0x00,0x00,0x03,0x80,0x00, 0x00,0x02,0x00,0x00,0x00,0x01, 0x00,0x00,0x00,0x00, }; /* */ unsigned char code code_display5[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text : ; Width x Height (pixels) :32X4 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/16Byte ; Font make date : 3/8/2011 10:55:48 PM ------------------------------------------------------------------------------*/ 0x20,0x04,0x04,//Width pixels,Height pixels,Width bytes 0x77,0x77,0x77,0x77,0xBB,0xBB,0xBB,0xBB,0xDD,0xDD, 0xDD,0xDD,0xEE,0xEE,0xEE,0xEE, }; /* D:\led sign\led trai tim 32c\22.bmp */ unsigned char code code_display6[]= { /*------------------------------------------------------------------------------ ; If font display distortion, please check Fonts format of setup. ; Source file / text :D:\led sign\led trai tim 32c\6.bmp ; Width x Height (pixels) :16X136 ; Font Format/Size : Monochrome LCD Fonts ,Horizontal scan ,Big endian order/272Byte ; Font make date : 3/9/2011 1:13:54 AM ------------------------------------------------------------------------------*/ 0x10,0x88,0x02,//Width pixels,Height pixels,Width bytes 0x7F,0xFF,0xBF,0xFF,0xDF,0xFF,0xEF,0xFF,0xF7,0xFF, 0xFB,0xFF,0xFD,0xFF,0xFE,0xFF, 0xFF,0x7F,0xFF,0xBF,0xFF,0xDF,0xFF,0xEF,0xFF,0xF7, 0xFF,0xFB,0xFF,0xFD,0xFF,0xFE, 0x7F,0xFE,0xBF,0xFE,0xDF,0xFE,0xEF,0xFE,0xF7,0xFE, 0xFB,0xFE,0xFD,0xFE,0xFE,0xFE, 0xFF,0x7E,0xFF,0xBE,0xFF,0xDE,0xFF,0xEE,0xFF,0xF6, 0xFF,0xFA,0xFF,0xFC,0x7F,0xFC, 0xBF,0xFC,0xDF,0xFC,0xEF,0xFC,0xF7,0xFC,0xFB,0xFC, 0xFD,0xFC,0xFE,0xFC,0xFF,0x7C, 0xFF,0xBC,0xFF,0xDC,0xFF,0xEC,0xFF,0xF4,0xFF,0xF8, 0x7F,0xF8,0xBF,0xF8,0xDF,0xF8, 0xEF,0xF8,0xF7,0xF8,0xFB,0xF8,0xFD,0xF8,0xFE,0xF8, 0xFF,0x78,0xFF,0xB8,0xFF,0xD8, 0xFF,0xE8,0xFF,0xF0,0x7F,0xF0,0xBF,0xF0,0xDF,0xF0, 0xEF,0xF0,0xF7,0xF0,0xFB,0xF0, 0xFD,0xF0,0xFE,0xF0,0xFF,0x70,0xFF,0xB0,0xFF,0xD0, 0xFF,0xE0,0x7F,0xE0,0xBF,0xE0, 0xDF,0xE0,0xEF,0xE0,0xF7,0xE0,0xFB,0xE0,0xFD,0xE0, 0xFE,0xE0,0xFF,0x60,0xFF,0xA0, 0xFF,0xC0,0x7F,0xC0,0xBF,0xC0,0xDF,0xC0,0xEF,0xC0, 0xF7,0xC0,0xFB,0xC0,0xFD,0xC0, 0xFE,0xC0,0xFF,0x40,0xFF,0x80,0x7F,0x80,0xBF,0x80, 0xDF,0x80,0xEF,0x80,0xF7,0x80, 0xFB,0x80,0xFD,0x80,0xFE,0x80,0xFF,0x00,0x7F,0x00, 0xBF,0x00,0xDF,0x00,0xEF,0x00, 0xF7,0x00,0xFB,0x00,0xFD,0x00,0xFE,0x00,0x7E,0x00, 0xBE,0x00,0xDE,0x00,0xEE,0x00, 0xF6,0x00,0xFA,0x00,0xFC,0x00,0x7C,0x00,0xBC,0x00, 0xDC,0x00,0xEC,0x00,0xF4,0x00, 0xF8,0x00,0x78,0x00,0xB8,0x00,0xD8,0x00,0xE8,0x00, 0xF0,0x00,0x70,0x00,0xB0,0x00, 0xD0,0x00,0xE0,0x00,0x60,0x00,0xA0,0x00,0xC0,0x00, 0x40,0x00,0x80,0x00,0x00,0x00, };
Link video tham khảo thêm tương tự nè. https://www.youtube.com/watch?v=PfU3KO658IU
Code làm theo là chạy, ai làm rồi up cái video lên youtube xem với nha.
Còn ai muốn hiểu code thì chịu ngâm cứu từ đầu và suy nghĩ tí chứ đừng hỏi tại sao và tại sao nha.
Còn nợ các bác cái code ASM, hy vọng sẽ có trong năm mới này. Hoặc ai giúp cái, tui sẽ hỗ trợ chỉnh sửa cho!Last edited by daituong1102; 21-02-2014, 10:57.
Comment
-
Nguyên văn bởi chjpchjp1991Bạn qua link này nhé.cuối bài viết code đã compile và xuất hex theo yêu cầu..Led trái tim sao băng code C full - Version Final | Blog Điện Tử | Tin Học - Chia sẻ kiến thức- Kết nối đam mê Điện Tử
Comment
-
mọi người ơi bài này nạp cho mạch nối thứ tự port từ phải qua trái lần lượt là P0>>P2>>P3>>P1
mình mua mạch sẵn nó lắp lần lượt P2>>P3>>P1>>P0
có cách nào chỉnh sửa phần mềm theo mạch được k ạ.
mong mọi người giúp mình vs.
mình đã chỉnh code lại nhưng k đúng thì phải. nó vẫn vậy.
Comment
-
Nguyên văn bởi nhandientuvnCòn cách PWM cho LED full (IC LPD6803) thì sao nhỉ? có bạn nào ý kiến gì không?Email:
Phone: 0969 226 539
Comment
-
Mọi nguòi có thể xem video về loại LED này.
https://www.youtube.com/watch?v=HEKL...yer_detailpageEmail:
Phone: 0969 226 539
Comment
Bài viết mới nhất
Collapse
-
Trả lời cho Hỏi về bơm màng bldcbởi nhathung1101Thì đây là 4r điên nặng điện mà, nên họ show phần điện thôi. Phần "cốt lõi" có cái tay biên chắc sang Văn Môn rồi....
-
Channel: Điện tử dành cho người mới bắt đầu
30-11-2024, 18:54 -
-
Trả lời cho Chọn dây dẫn cho điện DC?bởi nhathung1101Điện DC đương nhiên là khác với AC rồi. Chỉ cần biết mặt chữ là thấy khác như gà trống với gà mái mà.
Còn về bản chất, AC là dòng điện hoạt động theo tần số. Tần số càng cao thì dây dẫn càng mỏng, nhẹ, vì hiệu ứng...-
Channel: Điện tử dành cho người mới bắt đầu
30-11-2024, 18:46 -
-
Trả lời cho Công thức điện tửbởi nhathung1101Ăn ít => Nói nhiều.
Nói nhiều => Làm ít.
Làm ít => Vợ mắng.
Vợ mắng => Cáu nhiều.
Cáu nhiều => Ngủ ít.
Ngủ ít => Râu nhiều.
Râu nhiều =>...-
Channel: Tâm tình dân kỹ thuật
30-11-2024, 18:39 -
-
Trả lời cho Chọn dây dẫn cho điện DC?bởi mèomướpDạ vài chục mét thì chú tính như vậy được ạ. Chứ chuẩn thì phải tính cả điện trở của toàn bộ chiều dài dây dẫn nhân với dòng điện xem sụt áp có trong khoảng chấp nhận đc hông ạ. Trong mạch điện tử khoảng cách ngắn và mạch...
-
Channel: Điện tử dành cho người mới bắt đầu
30-11-2024, 14:49 -
-
bởi vietroadTheo mình biết thì chọn dây dẫn dựa vào dòng tải. Thường thì tiết diện 1mm2 cho dòng 6A. Nhưng trong các mạch điện tử, như mạch nguồn tổ ong chẳng hạn, dòng đến vài chục Ampe mà đường mạch mỏng dính. Phải chăng điện DC nó khác với...
-
Channel: Điện tử dành cho người mới bắt đầu
30-11-2024, 14:19 -
-
Trả lời cho Hỏi về bơm màng bldcbởi vi van phamPhải xem cơ cấu bơm, chứ xem cơ cấu rotor, thì chỉ làm thầy bói xem voi.
-
Channel: Điện tử dành cho người mới bắt đầu
29-11-2024, 08:19 -
-
Trả lời cho Xin hỏi về màn hình laptopbởi yname11vg, cám ơn bác...........
-
Channel: Thiết bị điện tử cá nhân
28-11-2024, 14:37 -
-
bởi khoine9899
Em chào các anh và mọi người.
Hiện em đang có 1 con bơm màng trong thiết bị y tế đang gặp tình trạng yếu dần hoặc ngừng hoạt động sau thời gian sử dụng
Sau khi tìm hiểu về thông tin của bơm trên mạng thì em được biết...-
Channel: Điện tử dành cho người mới bắt đầu
28-11-2024, 11:22 -
-
Trả lời cho Cần mọi người giúp mạch tạo sóng siêu âm máy rửabởi bqviet
-
Channel: Điện tử công suất
27-11-2024, 20:26 -
-
bởi Minhdai95Em chào mọi người, e đang sửa mạch tạo sóng siêu âm cho máy rửa mà chưa có tài liệu để tham khảo sửa, mọi người cho e xin tài liệu ạ...
-
Channel: Điện tử công suất
27-11-2024, 11:37 -
Comment