Thông báo

Collapse
No announcement yet.

Sừa lại dùm em

Collapse
X
 
  • Lọc
  • Giờ
  • Show
Clear All
new posts

  • Sừa lại dùm em

    em có code của led ma trận 2 bộ 8x8

    #include<reg52.h>
    #include<string.h>

    void delay(int t)
    {
    int a;
    for(a=0;a<t;a++)
    {}
    }
    int m,n,p;
    unsigned char code cot[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
    unsigned char code ma1[]={

    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0xFE,0x82,0x82,0x82,0x44,0x38,0x00,0x00, // D
    0x7C,0x82,0x82,0x82,0x82,0x7C,0x00,0x00, // O
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0xF8,0x14,0x12,0x12,0x14,0xF8,0x00,0x00, // A
    0xFE,0x04,0x08,0x10,0x20,0xFE,0x00,0x00, // N
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0xFE,0x04,0x08,0x10,0x08,0x04,0xFE,0x00, // M
    0x7C,0x82,0x82,0x82,0x82,0x7C,0x00,0x00, // O
    0xFE,0x04,0x08,0x10,0x20,0xFE,0x00,0x00, // N
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0xFE,0x10,0x10,0x10,0x10,0xFE,0x00,0x00, // H
    0x7C,0x82,0x82,0x82,0x82,0x7C,0x00,0x00, // O
    0x7C,0x82,0x82,0x82,0x82,0x44,0x00,0x00, // C
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    },
    ma2[]={
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x4C,0x92,0x92,0x92,0x64,0x00,0x00,0x00, // S
    0x88,0xFA,0x80,0x00,0x00,0x00,0x00,0x00, // i
    0xF8,0x04,0x04,0x04,0xF8,0x00,0x00,0x00, // n
    0xFE,0x10,0x08,0x08,0xF0,0x00,0x00,0x00, // h
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x3C,0x40,0x80,0x40,0x3C,0x00,0x00,0x00, // v
    0x88,0xFA,0x80,0x00,0x00,0x00,0x00,0x00, // i
    0x70,0xA8,0xA4,0xA4,0x18,0x00,0x00,0x00, // e
    0xF8,0x04,0x04,0x04,0xF8,0x00,0x00,0x00, // n
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x08,0x7E,0x88,0x48,0x00,0x00,0x00,0x00, // t
    0xFE,0x10,0x08,0x08,0xF0,0x00,0x00,0x00, // h
    0x78,0x80,0x80,0x80,0x78,0x00,0x00,0x00, // u
    0x78,0x84,0x84,0x84,0x48,0x00,0x00,0x00, // c
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0xFE,0x10,0x08,0x08,0xF0,0x00,0x00,0x00, // h
    0x88,0xFA,0x80,0x00,0x00,0x00,0x00,0x00, // i
    0x70,0xA8,0xA4,0xA4,0x18,0x00,0x00,0x00, // e
    0xF8,0x04,0x04,0x04,0xF8,0x00,0x00,0x00, // n
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    },
    ma3[]={
    0x02,0x02,0xFE,0x02,0x02,0x00,0x00,0x00, // T
    0x78,0x80,0x80,0x80,0x78,0x00,0x00,0x00, // u
    0xF8,0x04,0x04,0x04,0xF8,0x00,0x00,0x00, // n
    0x98,0xA4,0xA4,0xA4,0x78,0x00,0x00,0x00, // g
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x02,0x02,0xFE,0x02,0x02,0x00,0x00,0x00, // T
    0x88,0xFA,0x80,0x00,0x00,0x00,0x00,0x00, // i
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    };


    void matrix1()
    {
    P3=0xff;

    for(m=0;m<16*8;m++)
    {
    for(n=0;n<40;n++)
    {
    for(p=0;p<8;p++)
    {
    P0=cot[p];
    P1=~ma1[m+p];
    delay(10);
    P1=0XFF;
    P0=0xff; delay(10);
    }
    }
    }
    }

    void matrix2()
    {
    int i,j,k;
    P1=0xff;
    for(k=0;k<20*8;k++)
    {
    for(i=0;i<40;i++)
    {
    for(j=0;j<8;j++)
    {
    P0=cot[j];
    P3=~ma2[k+j];

    delay(10); P0=0XFF;
    P3=0xff; delay(10);
    }
    }
    }
    }

    void matrix3()
    {
    int a,b,c;
    for(a=0;a<25*8;a++)
    {
    for(b=0;b<40;b++)
    {
    for(c=0;c<8;c++)
    {
    P0=cot[c];
    P1=P3=~ma3[a+c];

    delay(10); P3=0XFF;P0=0xff; P1=0xff;delay(10);
    }
    }
    }
    }

    void main()
    {
    while(1)
    {
    matrix1();
    delay(10000);
    matrix2();
    delay(10000);
    matrix3();
    delay(10000);
    }
    }


    Anh nào giúp e sừa lai chạy với một ma trận 8x8 vẫn hiển thị dòng chữ như cũ. e cám ơn nhiều.

  • #2
    sừa lai giúp em với loại ma trận một màu thôi

    Comment

    Về tác giả

    Collapse

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

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

    Collapse

    Đang tải...
    X