1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Chương trình c mạch LED trái tim 8051 (code full)

20 3,3K 2

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 20
Dung lượng 106,08 KB

Nội dung

Trang 1

// project:mach led trai tim

// Design by leduche_dt3k3

// time:20:48/13/09/2009

// hotline:0979025040

// email:leduche90@gmail.com

//############################################

#include<reg52 >

#include<stdio >

#include<intrins >

unsigned int i, , ;

//###### ham delay tao thoi gian tre 0.5s ######

void delay(unsigned int ms)

{

unsigned int a;

unsigned char b;

for( = ; <ms; ++)

{

for( = ; <125; ++)

{

}

}

}

//##### hieu ung chop tat toan bo led ########

void hieu_ung_1(void)

{

for( = ; < ; ++)

{

P0=P1=P2=P3=0xff;

delay(300);

P0=P1=P2=P3=0x00;

delay(300);

}

}

//##### hieu ung chop 2 nua trai tim #########

void hieu_ung_2(void)

{

for( = ; < ; ++)

{

P0=P3=0x00;

delay(300);

P0=P3=0xff;

P1=P2=0x00;

delay(300);

P1=P2=0xff;

}

}

//##### hieu ung led nhay so le 1 ##############

void hieu_ung_3(void)

{

for( = ; < ; ++)

{

P0=P1=P2=P3=0x55;

delay(300);

P0=P1=P2=P3=0xaa;

delay(300);

}

}

//##### hieu ung led nhay so le 2 ##############

void hieu_ung_4(void)

{

for( = ; < ; ++)

{

P0=P1=P2=P3=0xaa;

delay(300);

P0=P1=P2=P3=0x55;

Trang 2

}

}

//##### p0,p1,p2,p3,p4 cung sang thuan ######

void hieu_ung_5(void)

{

unsigned char x, ;

x y 255;

i 1

j 128;

for( = ; < ; ++)

{

x x i

y y j

P0= ;

P1=P2=P3= ;

i i 2

j j 2

delay(300);

}

}

//##### p0,p1,p2,p3,p4 cung sang nghich ######

void hieu_ung_6(void)

{

unsigned char x, ;

x y 255;

i 1

j 128;

for( = ; < ; ++)

{

x x i

y y j

P0= ;

P1=P2=P3= ;

i i 2

j j 2

delay(300);

}

}

//##### sang dan het cac led theo chieu thuan ##

void hieu_ung_7(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

for( = ; < ; ++)

{

P2= [ ];

delay(300);

}for( = ; < ; ++)

{

P3= [ ];

delay(300);

}for( = ; < ; ++)

{

P1= [ ];

delay(300);

}

Trang 3

//##### tat dan het cac led theo chieu thuan ############

void hieu_ung_8(void)

{

unsigned char M[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff}; unsigned char N[]={0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};

P0=P1=P2=P3=0x00;

for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

for( = ; < ; ++)

{

P2= [ ];

delay(300);

}for( = ; < ; ++)

{

P3= [ ];

delay(300);

}for( = ; < ; ++)

{

P1= [ ];

delay(300);

}

}

//##### sang dan het cac led theo chieu nghich #####

void hieu_ung_9(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00}; unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P1= [ ];

delay(300);

}

for( = ; < ; ++)

{

P3= [ ];

delay(300);

}for( = ; < ; ++)

{

P2= [ ];

delay(300);

}for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

}

//##### tat dan het cac led theo chieu nghich #####

void hieu_ung_10(void)

{

unsigned char M[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff}; unsigned char N[]={0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};

P0=P1=P2=P3=0x00;

for( = ; < ; ++)

{

P1= [ ];

delay(300);

}

for( = ; < ; ++)

Trang 4

P3= [ ];

delay(300);

}for( = ; < ; ++)

{

P2= [ ];

delay(300);

}for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

}

//##### hieu ung pro 1 #################

void hieu_ung_11(void)

{

unsigned char M[]={0xf0,0xe1,0xc3,0x87,0x0f};

unsigned char N[]={0x0f,0x4f,0x63,0x71,0x78};

unsigned char L[]={0x1f,0x4f,0x6f,0x73,0x79,0x7c}; unsigned char K[]={0x3f,0x5f,0x6f,0x77,0x7b,0x7d,0x7e};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

P0=0xff;

for( = ; < ; ++)

{

P2= [ ];

delay(300);

}

P2=0x7f;

for( = ; < ; ++)

{

P3= [ ];

delay(300);

}

P2=P3=0x7f;

for( = ; < ; ++)

{

P1= [ ];

delay(300);

}

P1=P2=P3=0x7f;

}

//##### hieu ung pro 2 ###################

void hieu_ung_12(void)

{

unsigned char M[]={0xf0,0xe1,0xc3,0x87,0x0f};

unsigned char N[]={0xf0,0xe2,0xc6,0x8e,0x1e};

unsigned char L[]={0xf8,0xf2,0xe6,0xce,0x9e,0x3e}; unsigned char K[]={0x3f,0x5f,0x6f,0x77,0x7b,0x7d,0x7e};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P1= [ ];

delay(300);

}

P1=0xff;

for( = ; < ; ++)

{

P3= [ ];

delay(300);

}

Trang 5

for( = ; < ; ++)

{

P2= [ ];

delay(300);

}

P2=P3=0xfe;

for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

P0=0x7f;

P2=P3=0xfe;

}

//##### tat het cac led pr0 3 #######################

void hieu_ung_13(void)

{

unsigned char M[]={0xf8,0xf2,0xe6,0xce,0x9e,0x3e}; unsigned char N[]={0x1f,0x4f,0x67,0x73,0x79,0x7c};

P0=P1=P2=P3=0x00;

for( = ; < ; ++)

{

P3=P2=P1= [ ];

P0= [ ];

delay(300);

}

}

//##### tat het cac led pro 4 #######################

void hieu_ung_14(void)

{

unsigned char M[]={0xf8,0xf2,0xe6,0xce,0x9e,0x3e}; unsigned char N[]={0x1f,0x4f,0x67,0x73,0x79,0x7c};

P0=P1=P2=P3=0x00;

for( = ; < ; ++)

{

P3=P2=P1= [ ];

P0= [ ];

delay(300);

}

}

//##### sang dan het cac led 1 ##############

void hieu_ung_15(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P2= [ ];

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0=P1= [ ];

delay(300);

}

}

//##### sang dan het cac led 2 ##############

Trang 6

void hieu_ung_16(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0=P1= [ ];

delay(300);

}

for( = ; < ; ++)

{

P2= [ ];

P3= [ ];

delay(300);

}

}

//##### sang dan het cac led 3 ##############

void hieu_ung_17(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0=P2= [ ];

delay(300);

}

for( = ; < ; ++)

{

P1= [ ];

P3= [ ];

delay(300);

}

}

//##### sang dan het cac led 4 ##############

void hieu_ung_18(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P1= [ ];

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0=P2= [ ];

delay(300);

}

}

//##### sang dan het cac led 5 ##############

void hieu_ung_19(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

Trang 7

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P2= [ ];

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0=P1= [ ];

delay(300);

}

}

//##### sang dan het cac led 6 ##############

void hieu_ung_20(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0=P1=P2= [ ];

P3= [ ];

delay(300);

}

}

//##### sang dan het cac led 7 ##############

void hieu_ung_21(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

for( = ; < ; ++)

{

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P2= [ ];

delay(300);

}

for( = ; < ; ++)

{

P1= [ ];

delay(300);

}

}

//##### sang dan het cac led 8 ##############

void hieu_ung_22(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

Trang 8

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P1= [ ];

delay(300);

}

for( = ; < ; ++)

{

P2= [ ];

delay(300);

}

for( = ; < ; ++)

{

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

}

//##### sang dan het cac led 9 ##############

void hieu_ung_23(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00}; unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0=P2= [ ];

delay(300);

}

for( = ; < ; ++)

{

P1= [ ];

P3= [ ];

delay(300);

}

}

//##### sang dan het cac led 10 ##############

void hieu_ung_24(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0= [ ];

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P2=P1= [ ];

delay(300);

}

}

//##### sang dan het cac led 11 ##############

void hieu_ung_25(void)

Trang 9

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,

0x80,0x00};

unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,

0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P2=P1= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0= [ ];

P3= [ ];

delay(300);

}

}

//##### tat het cac led 1 #######################

void hieu_ung_26(void)

{

unsigned char M[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff}; unsigned char N[]={0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};

P0=P1=P2=P3=0x00;

for( = ; < ; ++)

{

P0=P1= [ ];

delay(300);

}

for( = ; < ; ++)

{

P3= [ ];

P2= [ ];

delay(300);

}

}

//##### tat het cac led 2 #######################

void hieu_ung_27(void)

{

unsigned char M[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff}; unsigned char N[]={0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};

P0=P1=P2=P3=0x00;

for( = ; < ; ++)

{

P2= [ ];

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0=P1= [ ];

delay(300);

}

}

//##### tat het cac led 3 #######################

void hieu_ung_28(void)

{

unsigned char M[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff}; unsigned char N[]={0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};

P0=P1=P2=P3=0x00;

for( = ; < ; ++)

{

P3= [ ];

Trang 10

P1= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0=P2= [ ];

delay(300);

}

}

//##### tat het cac led 4 #######################

void hieu_ung_45(void)

{

unsigned char M[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff}; unsigned char N[]={0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};

P0=P1=P2=P3=0x00;

for( = ; < ; ++)

{

P0=P2= [ ];

delay(300);

}

for( = ; < ; ++)

{

P1= [ ];

P3= [ ];

delay(300);

}

}

//##### tat het cac led 5 #######################

void hieu_ung_29(void)

{

unsigned char M[]={0x00,0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff}; unsigned char N[]={0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};

P0=P1=P2=P3=0x00;

for( = ; < ; ++)

{

P0=P2=P1= [ ];

P3= [ ];

delay(300);

}

}

//##### quet 3 led ############################

void hieu_ung_30(void)

{

unsigned char M[]={0xf8,0xf1,0xe3,0xc7,0x8f,0x1f,0x3f,0x7f,0xff}; unsigned char N[]={0x1f,0x8f,0xc7,0xe3,0xf1,0xf8,0xfc,0xfe,0xff};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

P0=0xff;

for( = ; < ; ++)

{

P2= [ ];

delay(300);

}

P2=0xff;

for( = ; < ; ++)

{

P3= [ ];

delay(300);

}

P3=0xff;

for( = ; < ; ++)

Trang 11

P1= [ ];

delay(300);

}

P1=0xff;

for( = ; < ; ++)

{

P1= [ ];

delay(300);

}

P1=0xff;

for( = ; < ; ++)

{

P3= [ ];

delay(300);

}

P3=0xff;

for( = ; < ; ++)

{

P2= [ ];

delay(300);

}

P2=0xff;

for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

P0=0xff;

for( = ; < ; ++)

{

P0= [ ];

P1= [ ];

delay(300);

}

P0=P1=0xff;

for( = ; < ; ++)

{

P2= [ ];

P3= [ ];

delay(300);

}

P2=P3=0xff;

for( = ; < ; ++)

{

P2= [ ];

P3= [ ];

delay(300);

}

P3=P2=0xff;

for( = ; < ; ++)

{

P0= [ ];

P1= [ ];

delay(300);

}

P1=P0=0xff;

}

//##### sang tang dan tat ca cac led so le nhau 1 ###

void hieu_ung_31(void)

{

unsigned char M[]={0xfe,0xf5,0xea,0xd5,0xaa,0x55}; unsigned char N[]={0x7f,0xaf,0x57,0xab,0x55,0xaa}; unsigned char L[]={0x55,0xaa};

unsigned char K[]={0xaa,0x55};

Trang 12

unsigned char H[]={0xaa,0x55};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0= [ ];

P2= [ ];

delay(300);

}

for( = ; < ; ++)

{

P2= [ ];

P0= [ ];

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0= [ ];

P2= [ ];

P3= [ ];

P1= [ ];

delay(300);

}

}

//##### sang tang dan tat ca cac led so le nhau 2 ###

void hieu_ung_32(void)

{

unsigned char M[]={0xfe,0xf5,0xea,0xd5,0xaa,0x55}; unsigned char N[]={0x7f,0xaf,0x57,0xab,0x55,0xaa}; unsigned char L[]={0x55,0xaa};

unsigned char K[]={0xaa,0x55};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P1= [ ];

delay(300);

}

for( = ; < ; ++)

{

P1= [ ];

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P1=P3= [ ];

P2= [ ];

delay(300);

}

for( = ; < ; ++)

{

P1=P2=P3= [ ];

P0= [ ];

delay(300);

}

}

//##### sang tang dan tat ca cac led so le nhau 3 ###

void hieu_ung_33(void)

{

unsigned char M[]={0xfe,0xf5,0xea,0xd5,0xaa,0x55};

Trang 13

unsigned char N[]={0x7f,0xaf,0x57,0xab,0x55,0xaa}; unsigned char L[]={0x55,0xaa};

unsigned char K[]={0xaa,0x55};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P2= [ ];

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P2= [ ];

P3= [ ];

P0=P1= [ ];

delay(300);

}

}

//##### sang tang dan tat ca cac led so le nhau 4 ###

void hieu_ung_34(void)

{

unsigned char M[]={0xfe,0xf5,0xea,0xd5,0xaa,0x55}; unsigned char N[]={0x7f,0xaf,0x57,0xab,0x55,0xaa}; unsigned char L[]={0x55,0xaa};

unsigned char K[]={0xaa,0x55};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0=P1= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0=P1= [ ];

P2= [ ];

P3= [ ];

delay(300);

}

}

//##### sang tang dan tat ca cac led so le nhau 5 ###

void hieu_ung_35(void)

{

unsigned char M[]={0xfe,0xf5,0xea,0xd5,0xaa,0x55}; unsigned char N[]={0x7f,0xaf,0x57,0xab,0x55,0xaa}; unsigned char L[]={0x55,0xaa};

unsigned char K[]={0xaa,0x55};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0=P2= [ ];

delay(300);

}

for( = ; < ; ++)

{

P0=P2= [ ];

P1= [ ];

P3= [ ];

delay(300);

}

}

//##### sang tang dan tat ca cac led so le nhau 6 ###

void hieu_ung_36(void)

{

unsigned char M[]={0xfe,0xf5,0xea,0xd5,0xaa,0x55}; unsigned char N[]={0x7f,0xaf,0x57,0xab,0x55,0xaa};

Trang 14

unsigned char L[]={0x55,0xaa};

unsigned char K[]={0xaa,0x55};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P1= [ ];

P3= [ ];

delay(300);

}

for( = ; < ; ++)

{

P1= [ ];

P3= [ ];

P0=P2= [ ];

delay(300);

}

}

//##### hieu ung dong ho tich tac 1 ############

void hieu_ung_37(void)

{

unsigned char M[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,

0xbf,0x7f,0x7e,0x7d,0x7b,0x77,0x6f,0x5f,0x3f,0x3e, 0x3d,0x3b,0x37,0x2f,0x1f,0x1e,0x1d,0x1b,0x17,0x0f, 0x0e,0x0d,0x0b,0x07,0x06,0x05,0x03,0x02,0x01,0x00};

unsigned char N[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,

0xfd,0xfe,0x7e,0xbe,0xde,0xee,0xf6,0xfa,0xfc,0x7c, 0xbc,0xdc,0xec,0xf4,0xf8,0x78,0xb8,0xd8,0xe8,0xf0, 0x70,0xb0,0xd0,0xe0,0x60,0xa0,0xc0,0x40,0x80,0x00};

for( = ; <36; ++)

{

P0= [ ];

P1=P2=P3= [ ];

delay(400);

}

}

//##### hieu ung dong ho tich tac 2 #########

void hieu_ung_38(void)

{

unsigned char M[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,

0xbf,0x7f,0x7e,0x7d,0x7b,0x77,0x6f,0x5f,0x3f,0x3e, 0x3d,0x3b,0x37,0x2f,0x1f,0x1e,0x1d,0x1b,0x17,0x0f, 0x0e,0x0d,0x0b,0x07,0x06,0x05,0x03,0x02,0x01,0x00};

unsigned char N[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,

0xfd,0xfe,0x7e,0xbe,0xde,0xee,0xf6,0xfa,0xfc,0x7c, 0xbc,0xdc,0xec,0xf4,0xf8,0x78,0xb8,0xd8,0xe8,0xf0, 0x70,0xb0,0xd0,0xe0,0x60,0xa0,0xc0,0x40,0x80,0x00};

for( = ; <36; ++)

{

P0= [ ];

P1=P2=P3= [ ];

delay(400);

}

}

//####### hieu ung dong ho tich tac 3 #######

void hieu_ung_39()

{

unsigned char L[]={0x00,0x01,0x02,0x04,0x08,0x10,

0x20,0x40,0x80,0x81,0x82,0x84,0x88,0x90,0xa0,0xc0, 0xc1,0xc2,0xc4,0xc8,0xd0,0xe0,0xe1,0xe2,0xe4,0xe8, 0xf0,0xf1,0xf2,0xf4,0xf8,0xf9,0xfa,0xfc,0xfd,0xfe, 0xff};

unsigned char K[]={0x00,0x80,0x40,0x20,0x10,0x08,

0x04,0x02,0x01,0x81,0x41,0x21,0x11,0x09,0x05,0x03,

Trang 15

0x83,0x43,0x23,0x13,0x0b,0x07,0x87,0x47,0x27,0x17,

0x0f,0x8f,0x4f,0x2f,0x1f,0x9f,0x5f,0x3f,0xbf,0x7f,

0xff};

for( = ; <37; ++)

{

P0= [ ];

P1=P2=P3= [ ];

delay(400);

}

}

//####### hieu ung dong ho tich tac 4 #######

void hieu_ung_40()

{

unsigned char L[]={0x00,0x01,0x02,0x04,0x08,0x10,

0x20,0x40,0x80,0x81,0x82,0x84,0x88,0x90,0xa0,0xc0,

0xc1,0xc2,0xc4,0xc8,0xd0,0xe0,0xe1,0xe2,0xe4,0xe8,

0xf0,0xf1,0xf2,0xf4,0xf8,0xf9,0xfa,0xfc,0xfd,0xfe,

0xff};

unsigned char K[]={0x00,0x80,0x40,0x20,0x10,0x08,

0x04,0x02,0x01,0x81,0x41,0x21,0x11,0x09,0x05,0x03,

0x83,0x43,0x23,0x13,0x0b,0x07,0x87,0x47,0x27,0x17,

0x0f,0x8f,0x4f,0x2f,0x1f,0x9f,0x5f,0x3f,0xbf,0x7f,

0xff};

for( = ; <37; ++)

{

P0= [ ];

P1=P2=P3= [ ];

delay(400);

}

}

//##### tang dan led 2 nua trai tim ##############

void hieu_ung_41(void)

{

unsigned char M[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00}; unsigned char N[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};

P0=P1=P2=P3=0xff;

for( = ; < ; ++)

{

P0= [ ];

P3= [ ];

delay(2500);

}

for( = ; < ; ++)

{

P2=P1= [ ];

delay(2500);

}

}

//##### giam dan led 2 nua trai tim ##############

void hieu_ung_42(void)

{

unsigned char M[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff}; unsigned char N[]={0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};

P0=P1=P2=P3=0x00;

for( = ; < ; ++)

{

P2=P1= [ ];

delay(2500);

}

for( = ; < ; ++)

{

Ngày đăng: 28/12/2015, 12:43

TỪ KHÓA LIÊN QUAN

w