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
 
  • Lọc
  • Giờ
  • Show
Clear All
new posts

  • #61
    Nguyên văn bởi nhandientuvn
    Con này dùng IC LPD 6803 điều khiển PWM để điều khiển 3 bóng LED RGB
    nếu có sẵn IC điều khiển PWM rồi thì chắc con led này cũng rất max và nó làm led sao băng thì có lẽ hơi phí.
    chỉ có tâm hồn là nơi duy nhất: có thể biến thiên đường thành địa ngục và ngược lại có thể biến địa ngục hóa thiên đường
    Everything should be made as simple as possible, but not simpler

    Comment


    • #62
      /*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


      • #63
        Ai giúp bác ý với kìa!

        Email:
        Tel: 0983.497.310

        Comment


        • #64
          em đợi mãi đợi mãi mà chưa thấy 1 đoạn nào asm hết...tụi em ko có học C nên chẳng hiểu gì bác ơi

          Comment


          • #65
            [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.
            Click image for larger version

Name:	IMAG0050 (FILEminimizer).jpg
Views:	1
Size:	29.1 KB
ID:	1391611
            Click image for larger version

Name:	IMAG0054 (FILEminimizer).jpg
Views:	1
Size:	26.1 KB
ID:	1391612
            Click image for larger version

Name:	IMAG0068 (FILEminimizer).jpg
Views:	1
Size:	25.1 KB
ID:	1391613

            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;
            }
            Header code "code_display_32c.h"
            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,0xFF,0xFE,0xFF,0xFF,0x7F,0xFD,0xFF,0xFF,0xBF,  0xFB,0xFF,0xFF,0xDF,0xF7,0xFF,
            0xFF,0xEF,0xEF,0xFF,0xFF,0xF7,0xDF,0xFF,0xFF,0xFB,  0xBF,0xFF,0xFF,0xFD,0x7F,0xFF,
            0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFE,0x7F,0xFE,  0xFF,0xFD,0xBF,0xFE,0xFF,0xFB,
            0xDF,0xFE,0xFF,0xF7,0xEF,0xFE,0xFF,0xEF,0xF7,0xFE,  0xFF,0xDF,0xFB,0xFE,0xFF,0xBF,
            0xFD,0xFE,0xFF,0x7F,0xFE,0xFE,0xFE,0xFF,0xFF,0x7E,  0xFD,0xFF,0xFF,0xBE,0xFB,0xFF,
            0xFF,0xDE,0xF7,0xFF,0xFF,0xEE,0xEF,0xFF,0xFF,0xF6,  0xDF,0xFF,0xFF,0xFA,0xBF,0xFF,
            0xFF,0xFC,0x7F,0xFF,0xFF,0xFC,0x7F,0xFE,0x7F,0xFC,  0x7F,0xFD,0xBF,0xFC,0x7F,0xFB,
            0xDF,0xFC,0x7F,0xF7,0xEF,0xFC,0x7F,0xEF,0xF7,0xFC,  0x7F,0xDF,0xFB,0xFC,0x7F,0xBF,
            0xFD,0xFC,0x7F,0x7F,0xFE,0xFC,0x7E,0xFF,0xFF,0x7C,  0x7D,0xFF,0xFF,0xBC,0x7B,0xFF,
            0xFF,0xDC,0x77,0xFF,0xFF,0xEC,0x6F,0xFF,0xFF,0xF4,  0x5F,0xFF,0xFF,0xF8,0x3F,0xFF,
            0xFF,0xF8,0x3F,0xFE,0x7F,0xF8,0x3F,0xFD,0xBF,0xF8,  0x3F,0xFB,0xDF,0xF8,0x3F,0xF7,
            0xEF,0xF8,0x3F,0xEF,0xF7,0xF8,0x3F,0xDF,0xFB,0xF8,  0x3F,0xBF,0xFD,0xF8,0x3F,0x7F,
            0xFE,0xF8,0x3E,0xFF,0xFF,0x78,0x3D,0xFF,0xFF,0xB8,  0x3B,0xFF,0xFF,0xD8,0x37,0xFF,
            0xFF,0xE8,0x2F,0xFF,0xFF,0xF0,0x1F,0xFF,0xFF,0xF0,  0x1F,0xFE,0x7F,0xF0,0x1F,0xFD,
            0xBF,0xF0,0x1F,0xFB,0xDF,0xF0,0x1F,0xF7,0xEF,0xF0,  0x1F,0xEF,0xF7,0xF0,0x1F,0xDF,
            0xFB,0xF0,0x1F,0xBF,0xFD,0xF0,0x1F,0x7F,0xFE,0xF0,  0x1E,0xFF,0xFF,0x70,0x1D,0xFF,
            0xFF,0xB0,0x1B,0xFF,0xFF,0xD0,0x17,0xFF,0xFF,0xE0,  0x0F,0xFF,0xFF,0xE0,0x0F,0xFE,
            0x7F,0xE0,0x0F,0xFD,0xBF,0xE0,0x0F,0xFB,0xDF,0xE0,  0x0F,0xF7,0xEF,0xE0,0x0F,0xEF,
            0xF7,0xE0,0x0F,0xDF,0xFB,0xE0,0x0F,0xBF,0xFD,0xE0,  0x0F,0x7F,0xFE,0xE0,0x0E,0xFF,
            0xFF,0x60,0x0D,0xFF,0xFF,0xA0,0x0B,0xFF,0xFF,0xC0,  0x07,0xFF,0xFF,0xC0,0x07,0xFE,
            0x7F,0xC0,0x07,0xFD,0xBF,0xC0,0x07,0xFB,0xDF,0xC0,  0x07,0xF7,0xEF,0xC0,0x07,0xEF,
            0xF7,0xC0,0x07,0xDF,0xFB,0xC0,0x07,0xBF,0xFD,0xC0,  0x07,0x7F,0xFE,0xC0,0x06,0xFF,
            0xFF,0x40,0x05,0xFF,0xFF,0x80,0x03,0xFF,0xFF,0x80,  0x03,0xFE,0x7F,0x80,0x03,0xFD,
            0xBF,0x80,0x03,0xFB,0xDF,0x80,0x03,0xF7,0xEF,0x80,  0x03,0xEF,0xF7,0x80,0x03,0xDF,
            0xFB,0x80,0x03,0xBF,0xFD,0x80,0x03,0x7F,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,
            };
            Video chạy cho code nè.


            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


            • #66
              Viết băm xung thì được rồi nhưng em không biết kết hợp băm xung với các hiệu ứng bác Huy à :v

              Comment


              • #67
                Nguyên văn bởi tienhuypro Xem bài viết
                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.
                [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;
                }
                Header code "code_display_32c.h"
                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,0xFF,0xFE,0xFF,0xFF,0x7F,0xFD,0xFF,0xFF,0xBF,  0xFB,0xFF,0xFF,0xDF,0xF7,0xFF,
                0xFF,0xEF,0xEF,0xFF,0xFF,0xF7,0xDF,0xFF,0xFF,0xFB,  0xBF,0xFF,0xFF,0xFD,0x7F,0xFF,
                0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFE,0x7F,0xFE,  0xFF,0xFD,0xBF,0xFE,0xFF,0xFB,
                0xDF,0xFE,0xFF,0xF7,0xEF,0xFE,0xFF,0xEF,0xF7,0xFE,  0xFF,0xDF,0xFB,0xFE,0xFF,0xBF,
                0xFD,0xFE,0xFF,0x7F,0xFE,0xFE,0xFE,0xFF,0xFF,0x7E,  0xFD,0xFF,0xFF,0xBE,0xFB,0xFF,
                0xFF,0xDE,0xF7,0xFF,0xFF,0xEE,0xEF,0xFF,0xFF,0xF6,  0xDF,0xFF,0xFF,0xFA,0xBF,0xFF,
                0xFF,0xFC,0x7F,0xFF,0xFF,0xFC,0x7F,0xFE,0x7F,0xFC,  0x7F,0xFD,0xBF,0xFC,0x7F,0xFB,
                0xDF,0xFC,0x7F,0xF7,0xEF,0xFC,0x7F,0xEF,0xF7,0xFC,  0x7F,0xDF,0xFB,0xFC,0x7F,0xBF,
                0xFD,0xFC,0x7F,0x7F,0xFE,0xFC,0x7E,0xFF,0xFF,0x7C,  0x7D,0xFF,0xFF,0xBC,0x7B,0xFF,
                0xFF,0xDC,0x77,0xFF,0xFF,0xEC,0x6F,0xFF,0xFF,0xF4,  0x5F,0xFF,0xFF,0xF8,0x3F,0xFF,
                0xFF,0xF8,0x3F,0xFE,0x7F,0xF8,0x3F,0xFD,0xBF,0xF8,  0x3F,0xFB,0xDF,0xF8,0x3F,0xF7,
                0xEF,0xF8,0x3F,0xEF,0xF7,0xF8,0x3F,0xDF,0xFB,0xF8,  0x3F,0xBF,0xFD,0xF8,0x3F,0x7F,
                0xFE,0xF8,0x3E,0xFF,0xFF,0x78,0x3D,0xFF,0xFF,0xB8,  0x3B,0xFF,0xFF,0xD8,0x37,0xFF,
                0xFF,0xE8,0x2F,0xFF,0xFF,0xF0,0x1F,0xFF,0xFF,0xF0,  0x1F,0xFE,0x7F,0xF0,0x1F,0xFD,
                0xBF,0xF0,0x1F,0xFB,0xDF,0xF0,0x1F,0xF7,0xEF,0xF0,  0x1F,0xEF,0xF7,0xF0,0x1F,0xDF,
                0xFB,0xF0,0x1F,0xBF,0xFD,0xF0,0x1F,0x7F,0xFE,0xF0,  0x1E,0xFF,0xFF,0x70,0x1D,0xFF,
                0xFF,0xB0,0x1B,0xFF,0xFF,0xD0,0x17,0xFF,0xFF,0xE0,  0x0F,0xFF,0xFF,0xE0,0x0F,0xFE,
                0x7F,0xE0,0x0F,0xFD,0xBF,0xE0,0x0F,0xFB,0xDF,0xE0,  0x0F,0xF7,0xEF,0xE0,0x0F,0xEF,
                0xF7,0xE0,0x0F,0xDF,0xFB,0xE0,0x0F,0xBF,0xFD,0xE0,  0x0F,0x7F,0xFE,0xE0,0x0E,0xFF,
                0xFF,0x60,0x0D,0xFF,0xFF,0xA0,0x0B,0xFF,0xFF,0xC0,  0x07,0xFF,0xFF,0xC0,0x07,0xFE,
                0x7F,0xC0,0x07,0xFD,0xBF,0xC0,0x07,0xFB,0xDF,0xC0,  0x07,0xF7,0xEF,0xC0,0x07,0xEF,
                0xF7,0xC0,0x07,0xDF,0xFB,0xC0,0x07,0xBF,0xFD,0xC0,  0x07,0x7F,0xFE,0xC0,0x06,0xFF,
                0xFF,0x40,0x05,0xFF,0xFF,0x80,0x03,0xFF,0xFF,0x80,  0x03,0xFE,0x7F,0x80,0x03,0xFD,
                0xBF,0x80,0x03,0xFB,0xDF,0x80,0x03,0xF7,0xEF,0x80,  0x03,0xEF,0xF7,0x80,0x03,0xDF,
                0xFB,0x80,0x03,0xBF,0xFD,0x80,0x03,0x7F,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,
                };
                Video chạy cho code nè.


                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!
                [MENTION=74931]tienhuypro[/MENTION] cho mình hỏi ! Code kia thì mình đã hiểu nhưng phần display này thì mình cho vào phần nào trên trương trình vậy , mình ko chuyên về cái này nhưng cũng nghịk ngợm chút cho đỡ buồn , mà cho mình hỏi là thạch anh dùng là 24M hay 12M , bạn trở lời gấp giúp mình nhé , mÀ nếu bạn có lòng thì cho mình luôn cái file Hex cho nhanh , inbox cho mình cũng được , mình đỡ phải lọ mọ thank bạn trước
                Last edited by daituong1102; 21-02-2014, 10:57.


                Comment


                • #68
                  Nguyên văn bởi chjpchjp1991
                  chào CHíp , mình đã nạp thử cả 2 trương trình , của bạn và của bạn huy nhưng kết quả ko giống video chút nào , lét chỉ tối đi chứ chưa tắt hẳn , sao băng chậm , mình đã thử cả thạch anh 12M và 24M kết quả đều thế , nhìn rất chán , bạn có cách nào giúp mình đc không , mình cũng là dân điện tử nhưng mà chuyên về mảng khác , nên cách kết nối và hàn gắn linh kiện thì bạn khỏi phải lo , không biết thế nào ! giờ đâm ra chán


                  Comment


                  • #69
                    rất hay, thank bạn đã chia sẻ

                    Comment


                    • #70
                      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


                      • #71
                        Nguyên văn bởi nhandientuvn
                        Còn cách PWM cho LED full (IC LPD6803) thì sao nhỉ? có bạn nào ý kiến gì không?
                        Con này có bộ điều khiển sẵn rồi, nó là lại led full colourl, Tùy theo lại IC điều khiển mà có bộ điều khiển và chuơng trình khác nhau,. IC LPD6830, D705, 1101 loại này có chân Vcc, GND, 1 chân DATA, và 1Clock để điều khiển, sử dụng CPU controller T1000S, các phần mềm tạo hiệu ứng như Ledwaker, LedEdit ...,> nói chung, Loại LED full màu này, tùy vào IC điều khiển mà có bộ điều khiển và phần mềm điều khiển khác nhau.
                        Email:
                        Phone: 0969 226 539

                        Comment


                        • #72
                          Mọi nguòi có thể xem video về loại LED này.
                          https://www.youtube.com/watch?v=HEKL...yer_detailpage
                          Email:
                          Phone: 0969 226 539

                          Comment


                          • #73
                            chắn wúa mãi mà ko có bằng ngôn ngữ assemnly c thì mình ko hoc tới
                            Cho bọn mình xin file bằng ngôn ngữ asm đi thank bn nhiều lắm đó

                            Comment


                            • #74
                              có thê dậy mình cách tạo ra hiệ ứng sao băng băng ngôn ngưc asm dc ko ban thank bn

                              Comment


                              • #75
                                theo mình cái này dùng 74hc595 nói chung mạch này mình làm rồi board khá bự, và khá loằng ngoằng. tiện đây cho mình hỏi chạy kiểu sao băng dùng bộ 74hc595 ai có code chuẩn up lên cho mọi người cùng ngâm dc không>> thanks
                                1+1=0 nhớ 1

                                Comment

                                Về tác giả

                                Collapse

                                tienhuypro Tìm hiểu thêm về tienhuypro

                                Bài viết mới nhất

                                Collapse

                                Đang tải...
                                X