Thông báo

Collapse
No announcement yet.

Lỗi tràn bộ nhớ trong 8051

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

  • Lỗi tràn bộ nhớ trong 8051

    e bị lỗi như thế này

    Build target 'Target 1'
    compiling code.c...
    linking...
    BL51 BANKED LINKER/LOCATER V6.22 - SN: Eval Version
    COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2009
    "STARTUP.obj",
    "code.obj"
    TO "code"
    RAMSIZE(256)
    ************************************************** ****************************
    * RESTRICTED VERSION WITH 0800H BYTE CODE SIZE LIMIT; USED: 1056H BYTE (204%) *
    ************************************************** ****************************
    Program Size: data=9.0 xdata=14 code=4182
    LINK/LOCATE RUN COMPLETE. 0 WARNING(S), 0 ERROR(S)
    *** FATAL ERROR L250: CODE SIZE LIMIT IN RESTRICTED VERSION EXCEEDED
    MODULE: C:\KEIL\C51\LIB\C51L.LIB (-----)
    LIMIT: 0800H BYTES
    Target not created

    các tiền bối giúp e

  • #2
    #include<reg52.h>
    #include<stdio.h>
    #include<intrins.h>

    sbit dulieu = P2^1;
    sbit xung = P2^0;
    sbit chot = P2^2;
    unsigned int n,m,k;
    void delay(unsigned char ms )
    {
    int i,j;
    for(i=0;i<ms;i++)
    {
    for(j=0;j<800;j++);

    }
    }

    void dich(unsigned char x)
    {
    int i,tam;
    for(i=0;i<8;i++)
    {
    tam=x;
    tam=tam&0x80;
    if(tam==0x80) dulieu=1;
    else dulieu=0;
    x=x<<1;
    xung=0;
    xung=1;
    }
    }
    void dich3(unsigned char a,unsigned char b,unsigned char c,unsigned char d)
    {
    dich(d);
    dich(c);
    dich(b);
    dich(a);
    }
    //********************Hieu ung nhap nhay******************************************/
    void nhapnhay()
    {
    int j,p;
    unsigned char code led1[]={0xaa,0x55};
    unsigned char code led2[]={0x55,0xaa};

    for(p=0;p<18;p++)
    for(j=0;j<2;j++)
    {
    dich3(led1[j],led2[j],led1[j],led2[j]);
    chot=0;
    chot=1;
    delay(8);
    }
    dich3(255,255,255,255);
    chot=0;
    chot=1;
    }
    //********************Hieu ung chay 2 nua cung 1 lan tu tren xuong******************************************/
    void chay2nuatrenxuong()
    {
    int j,x;
    unsigned char code led1[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00};
    unsigned char code led2[]={0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};
    x=0xff;
    for(j=0;j<9;j++)
    {
    if (j==8)
    x=0xfe;
    dich3(led1[j],led2[j],x,0xff);
    chot=0;
    chot=1;
    delay(20);
    }
    for(j=1;j<9;j++)
    {
    dich3(0x00,0x00,led1[j],led2[j]);
    chot=0;
    chot=1;
    delay(20);
    }
    }

    //********************Hieu ung tat 2 nua cung 1 lan tu tren xuong******************************************/
    void tat2nuatrenxuong()
    {
    int j,x;
    unsigned char code led1[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff,0xff};
    unsigned char code led2[]={0x00,0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff};
    x=0x00;
    for(j=0;j<9;j++)
    {
    if (j==8)
    x=0x01;
    dich3(led1[j],led2[j],x,0x00);
    chot=0;
    chot=1;
    delay(20);
    }
    for(j=1;j<9;j++)
    {
    dich3(0xff,0xff,led1[j],led2[j]);
    chot=0;
    chot=1;
    delay(20);
    }
    }
    //********************Hieu ung chay 2 nua lan luot******************************************/
    void chaynuavong()
    {
    int j;
    unsigned char code led[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xe0,0xc0,0x80,0x00};
    unsigned char code ledd[]={0xff,0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};

    for(j=0;j<9;j++)
    {
    dich3(led[j],0xff,0xff,ledd[j]);
    chot=0;
    chot=1;
    delay(30);
    }
    for(j=0;j<8;j++)
    {
    dich3(0,ledd[j],led[j],0);
    chot=0;
    chot=1;
    delay(30);
    }
    }

    //********************Hieu ung sang tu 4 goc,sang dan het led******************************************/
    void led4goc1()
    {
    int j;
    unsigned char code led1[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x01,0x0 3,0x07,0x0f,0x1f,0x3f,0x7f,0xff,0xfe,0x7e,0x3e,0x1 e,0x0e,0x06,0x02,0x00,0x40,0x60,0x70,0x78,0x7c,0x7 e,0x7f,0xff};
    unsigned char code led2[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00,0x80,0xc 0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff,0x7f,0x7e,0x7c,0x7 8,0x70,0x60,0x40,0x00,0x02,0x06,0x0e,0x1e,0x3e,0x7 e,0xfe,0xff};
    unsigned char code led3[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x01,0x0 3,0x07,0x0f,0x1f,0x3f,0x7f,0xff,0xfe,0x7e,0x3e,0x1 e,0x0e,0x06,0x02,0x00,0x40,0x60,0x70,0x78,0x7c,0x7 e,0x7f,0xff};
    unsigned char code led4[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00,0x80,0xc 0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff,0x7f,0x7e,0x7c,0x7 8,0x70,0x60,0x40,0x00,0x02,0x06,0x0e,0x1e,0x3e,0x7 e,0xfe,0xff};

    for(j=0;j<32;j++)
    {
    dich3(led1[j],led2[j],led3[j],led4[j]);
    chot=0;
    chot=1;
    delay(40);
    }
    }
    //********************Hieu ung sang tung led cho den het tu 4 goc ******************************************/
    void led4goc2()
    {
    int j;
    unsigned char code led1[]={254,253,251,247,239,223,191,127,126,125,123,119, 111,95,63,62,61,59,55,47,31,30,29,27,23,15,14,13,1 1,7,6,5,3,2,1,0}; //sang dan tung bong den cuoi,giu lai bogn cuoi
    unsigned char code led2[]={127,191,223,239,247,251,253,254,126,190,222,238, 246,250,252,124,188,220,236,244,248,120,184,216,23 2,240,112,176,208,224,96,160,192,64,128,0}; //u cuoi den dau
    for(j=0;j<36;j++)
    {
    dich3(led1[j],led2[j],led1[j],led2[j]);
    chot=0;
    chot=1;
    delay(40);
    }

    for(j=0;j<36;j++)
    {
    dich3(led2[j],led1[j],led2[j],led1[j]);
    chot=0;
    chot=1;
    delay(40);
    }
    }

    //********************Hieu ung chay tung cai tren xuong,lan luot 2 ben******************************************/
    void lanluottrenxuong()
    {
    int j; // 17 33 49 64 80 95 100 126 148 150 170 190 208 210 r 230 250 270 283 288
    unsigned char code led1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xb f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xd f,0xbf,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xe f,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xe f,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xff,0xff,0xfe,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf e,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xf f,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7 f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xf e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xf d,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xfe,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xe f,0xdf,0xbf,0x7f,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7 f,0x7e,0x7d,0x7b,0x77,0x6f,0x5f,0x3f,0x3e,0x3f,0x3 f,0x3f,0x3f,0x3f,0x3e,0x3d,0x3b,0x37,0x2f,0x1f,0x1 e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1d,0x1b,0x17,0x0f,0x0 e,0x0f,0x0f,0x0f,0x0e,0x0d,0x0b,0x07,0x06,0x07,0x0 7,0x06,0x05,0x03,0x02,0x03,0x02,0x01,0x00};
    unsigned char code led2[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xf d,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xb f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xf d,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7 f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x7f,0x7 f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7e,0x7 d,0x7b,0x77,0x6f,0x5f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3 f,0x3f,0x3f,0x3f,0x3f,0x3e,0x3d,0x3b,0x37,0x2f,0x1 f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1 d,0x1b,0x17,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0 f,0x0e,0x0d,0x0b,0x07,0x07,0x07,0x07,0x07,0x07,0x0 7,0x06,0x05,0x03,0x03,0x03,0x03,0x03,0x03,0x02,0x0 1,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00};
    unsigned char code led3[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xf d,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x7 f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7 f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7 f,0x7f,0x7f,0x7e,0x7d,0x7b,0x77,0x6f,0x5f,0x3f,0x3 f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3 f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3 f,0x3f,0x3f,0x3f,0x3e,0x3d,0x3b,0x37,0x2f,0x1f,0x1 f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1 f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1 f,0x1f,0x1f,0x1f,0x1e,0x1d,0x1b,0x17,0x0f,0x0f,0x0 f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0 f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0e,0x0d,0x0 b,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x0 7,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x0 7,0x06,0x05,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x0 3,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02,0x0 1,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x0 1,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
    unsigned char code led4[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0x7 f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7e,0x7d,0x7b,0x7 7,0x6f,0x5f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3 f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3 f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3e,0x3 d,0x3b,0x37,0x2f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1 f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1 f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1 d,0x1b,0x17,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0 f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0 f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0 f,0x0f,0x0e,0x0d,0x0b,0x07,0x07,0x07,0x07,0x07,0x0 7,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x0 7,0x07,0x07,0x07,0x07,0x07,0x07,0x06,0x05,0x03,0x0 3,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x0 3,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x0 3,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x0 1,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
    for(j=0;j<288;j++)
    {
    dich3(led1[j],led2[j],led3[j],led4[j]);
    chot=0;
    chot=1;
    delay(15);
    }
    }
    //********************Hieu ung giong hanh******************************************/
    void chay2chieu()
    {
    int j; // 0 16 32 48 62 78 89 j 104 115 130
    unsigned char code led1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0x7f,0xbf,0xdf,0xef,0xf 7,0xfb,0xfd,0xfe,0xfc,0xfa,0xf6,0xee,0xde,0xbe,0x7 e,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xf e,0xfe,0xfe,0xfe,0xfe,0xfe,0x7e,0xbe,0xde,0xee,0xf 6,0xfa,0xfc,0xf8,0xf4,0xec,0xdc,0xbc,0x7c,0xfc,0xf c,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xf c,0xfc,0x7c,0xbc,0xdc,0xec,0xf4,0xf8,0xf0,0xe8,0xd 8,0xb8,0x78,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf 8,0xf8,0xf8,0xf8,0x78,0xb8,0xd8,0xe8,0xf0,0xe0,0xd 0,0xb0,0x70,0x70,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf 0,0xf0,0x70,0xb0,0xd0,0xe0,0xc0,0xa0,0x60,0xe0,0xe 0,0xe0,0xe0,0xe0,0xe0,0xe0,0x60,0xa0,0xc0,0x80,0x4 0,0xc0,0xc0,0xc0,0xc0,0xc0,0x40,0x80,0x00,0x80,0x8 0,0x80,0x00,0x00};
    unsigned char code led2[]={0xff,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x7f,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xf b,0xfd,0xfe,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xb f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xf b,0xfd,0xfe,0xfc,0xfa,0xf6,0xee,0xde,0xbe,0x7e,0xf e,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xf e,0x7e,0xbe,0xde,0xee,0xf6,0xfa,0xfc,0xf8,0xf4,0xe c,0xdc,0xbc,0x7c,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xf c,0xfc,0xfc,0x7c,0xbc,0xdc,0xec,0xf4,0xf8,0xf0,0xe 8,0xd8,0xb8,0x78,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf 8,0x78,0xb8,0xd8,0xe8,0xf0,0xe0,0xd0,0xb0,0x70,0xf 0,0xf0,0xf0,0xf0,0xf0,0x70,0xb0,0xd0,0xe0,0xc0,0xa 0,0x60,0xe0,0xe0,0xe0,0x60,0xa0,0xc0,0x80,0x40,0xc 0,0x40,0x80,0x00};
    unsigned char code led3[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xf d,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0x7f,0xbf,0xd f,0xef,0xf7,0xfb,0xfd,0xfe,0xff,0xff,0xff,0xff,0xf f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf f,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x3f,0x5 f,0x6f,0x77,0x7b,0x7d,0x7e,0x7f,0x7f,0x7f,0x7f,0x7 f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7e,0x7 d,0x7b,0x77,0x6f,0x5f,0x3f,0x1f,0x2f,0x37,0x3b,0x3 d,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3 f,0x3f,0x3f,0x3e,0x3d,0x3b,0x37,0x2f,0x1f,0x0f,0x1 7,0x1b,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1 f,0x1f,0x1f,0x1e,0x1d,0x1b,0x17,0x0f,0x07,0x0b,0x0 d,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0e,0x0 d,0x0b,0x07,0x03,0x05,0x06,0x07,0x07,0x07,0x07,0x0 7,0x06,0x05,0x03,0x01,0x02,0x03,0x03,0x03,0x02,0x0 1,0x00,0x01,0x00};
    unsigned char code led4[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf e,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x3f,0x5f,0x6 f,0x77,0x7b,0x7d,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7 f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7 f,0x7f,0x7e,0x7d,0x7b,0x77,0x6f,0x5f,0x3f,0x1f,0x2 f,0x37,0x3b,0x3d,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3 f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3 e,0x3d,0x3b,0x37,0x2f,0x1f,0x0f,0x17,0x1b,0x1d,0x1 e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1 f,0x1f,0x1f,0x1f,0x1e,0x1d,0x1b,0x17,0x0f,0x07,0x0 b,0x0d,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0 f,0x0f,0x0f,0x0f,0x0e,0x0d,0x0b,0x07,0x03,0x05,0x0 6,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x0 6,0x05,0x03,0x01,0x02,0x03,0x03,0x03,0x03,0x03,0x0 3,0x03,0x02,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x0 0,0x00,0x00,0x00};
    for(j=0;j<153;j++) // d87654
    {
    dich3(led1[j],led2[j],led3[j],led4[j]);
    chot=0;
    chot=1;
    delay(20);

    }
    }
    //********************Hieu ung sang led 1 + led 16 roi chay nua vong ******************************************/
    void led1va16chay180()
    {
    int i,j;
    unsigned char code led1[]={254,253,251,247,239,223,191,127};
    unsigned char code led2[]={127,191,223,239,247,251,253,254};
    for(i=0;i<2;i++)
    {
    for(j=0;j<8;j++)
    {
    dich3(led1[j],255,255,led2[j]);
    chot=0;
    chot=1;
    delay(10);
    }
    for(j=0;j<8;j++)
    {
    dich3(255,led2[j],led1[j],255);
    chot=0;
    chot=1;
    delay(10);
    }
    dich3(0xfe,0xff,0xff,0x7f);
    chot=0;
    chot=1;
    delay(80);
    for(j=0;j<8;j++)
    {
    dich3(255,led1[j],led2[j],255);
    chot=0;
    chot=1;
    delay(10);
    }
    for(j=0;j<8;j++)
    {
    dich3(led2[j],255,255,led1[j]);
    chot=0;
    chot=1;
    delay(10);
    }
    delay(70);
    }
    }
    //********************Hieu ung xoay nhanh tung led tu 4 goc thanh 1 vong nguoc kim dong ho ******************************************/
    void led4goc3nguoc()
    {
    int j,i;
    unsigned char code led1[]={252,250,246,238,222,190,126};
    unsigned char code led2[]={63,95,111,119,123,125,126};
    dich3(254,127,254,127);
    chot=0;
    chot=1;
    delay(20);
    for(i=0;i<15;i++)
    for(j=0;j<7;j++)
    {
    dich3(led1[j],led2[j],led1[j],led2[j]);
    chot=0;
    chot=1;
    delay(20);
    }
    }
    //********************Hieu ung xoay nhanh tung led tu 4 goc thanh 1 vong thuan kim dong ho ******************************************/
    void led4goc3thuan()
    {
    int j,i;
    unsigned char code led1[]={252,250,246,238,222,190,126};
    unsigned char code led2[]={63,95,111,119,123,125,126};
    dich3(254,127,254,127);
    chot=0;
    chot=1;
    delay(15);
    for(i=0;i<15;i++)
    for(j=0;j<7;j++)
    {
    dich3(led2[j],led1[j],led2[j],led1[j]);
    chot=0;
    chot=1;
    delay(15);
    }
    }


    //*************chuong trinh chinh***************
    void main(void)
    {P0=1;
    P3=0;
    nhapnhay();
    chay2nuatrenxuong();
    tat2nuatrenxuong();
    nhapnhay();
    chaynuavong();
    lanluottrenxuong();
    nhapnhay();//them nhap nhay
    nhapnhay();
    led4goc3nguoc();
    led4goc3thuan(); //xem lai cai nay
    nhapnhay();
    nhapnhay();
    led4goc1();
    nhapnhay();
    led4goc2();
    nhapnhay();
    chay2chieu();
    nhapnhay();
    led1va16chay180(); //sua lai cai nay 1 ti
    nhapnhay();
    }

    đây là code của e

    Comment


    • #3
      k ai giúp à

      Comment


      • #4
        Bạn dùng bản dùng thử nên hạn chế code tối đa là 2K thôi. Thông báo rõ ràng thế còn gì.
        AVR đã quay trở lại: ATMEGA32: 66k, ATMEGA8A: 30k, ATMEGA48: 30k.
        Xem thêm tại Online Store ---> Click here
        Mob: 0982.083.106

        Comment


        • #5
          oh.vậy à.vậy có bản nào ***** k bạn

          Comment


          • #6
            Vấn đề này nhiều người hỏi quá nhỉ. ... Đây, nhanh kẻo link die Keil.RealView.Microcontroller.Development.Kit.v3.2 0_to_v4_EDGE.zip.7z

            Comment


            • #7
              thanks cả nhà.e làm được rùi

              Comment

              Về tác giả

              Collapse

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

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

              Collapse

              Đang tải...
              X