Thông báo

Collapse
No announcement yet.

Sửa giúp câiis này với mấy anh ơi????????????????????

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

  • Sửa giúp câiis này với mấy anh ơi????????????????????

    Code như sau
    #include <REG52.H>

    void delay_ms(unsigned char n)
    {
    unsigned char i,j;
    for(i=0;i<n;i++){
    for(j=0;j<120;j++){}
    }
    }

    void main(){
    // khai báo các bien dem hieu ung
    unsigned char i=0;
    unsigned char j=0;
    unsigned char x=0;
    //chay duong vien
    unsigned char code border[]={0xFE,0xFD,0xFB,0xF7,0xEF};

    unsigned char code effectP0[]={0xFF,0x00,0xFF,0x00,0xFE,0xFD,0xFB,0xF7,0xEF,0xD F,0xBF,0x7F,0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xF E,
    0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xBF, 0xDF,0xEF,0xF7,0xFB,0xFD,0xFE};

    unsigned char code effectP2[]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0x7E,0xB E,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,0xFE,0xFD,0xFB,
    0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xBF,0xDF,0xEF,0xF7, 0xFB,0xFD,0xFE,0x55,0xAA,0x55,0xAA,0x55,0xAA,0xFF,
    0xFF,0xFF,0x55,0xAA,0x55,0xAA,0x55,0xFF,0xFF};
    while(1){
    if(i<sizeof(effectP2)){
    P2=~effectP2[i];
    i++;
    }else{
    i=0;
    }

    if(j<sizeof(effectP0)){
    P0=~effectP0[j];
    j++;
    }else{
    j=0;
    }
    delay_ms(400);

    if(x<sizeof(border)){
    P1=~border[x];
    x++;
    }else{
    x=0;
    }
    delay_ms(800);
    }
    }
    anh ơi e dịch bằng kiel nó báo lỗi nay nè a:
    C++.C(29): error C141: syntax error near ')'
    C++.C(32): error C141: syntax error near 'else'
    C++.C(34): error C141: syntax error near '}'
    C++.C(36): error C141: syntax error near '<', expected ')'
    C++.C(36): error C129: missing ';' before ')'
    Target not created

    while(1){
    if(i<sizeof(effectP2)){
    P2=~effectP2[i];
    i++;
    }else{
    i=0;
    }

    lệnh này e hok hiểu "sizeof"
    mong a hồi âm sớm.

  • #2
    lỗi báo lên các vị trí các dòng lệnh sai hoặc dòng lệnh sử dụng các thành phần nào đó trong chương trình sai
    nhìn sơ qua 2 cái mảng P0 và P2 viết sai, thừa cả đống space
    Website chính thức đổi địa chỉ website thành
    Mời các bạn ghé thăm !!!

    Comment


    • #3
      e sửa tên mảng rồi ma cũng hok được. anh giúp dùm em

      Comment


      • #4
        mấy anh ơi giúp e với, tối giơ ma vẫn mò chưa ra nữa

        Comment


        • #5
          #include <REGx52.H>
          void delay_ms(unsigned char n)
          {
          unsigned char i,j;
          for(i=0;i<n;i++){
          for(j=0;j<120;j++){}
          }
          }

          void main(){
          // khai báo các bien dem hieu ung
          unsigned char i=0;
          unsigned char j=0;
          unsigned char x=0;
          //chay duong vien
          unsigned char code border[]={0xFE,0xFD,0xFB,0xF7,0xEF};
          unsigned char code effectP0[]={0xFF,0x00,0xFF,0x00,0xFE,0xFD,0xFB,0xF7,0xEF,0xD F,0xBF,0x7F,0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xF E,0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xB F, 0xDF,0xEF,0xF7,0xFB,0xFD,0xFE};
          unsigned char code effectP2[]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0x7E,0xB E,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,0xFE,0xFD,0xFB,
          0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xBF,0xDF,0xEF,0xF7, 0xFB,0xFD,0xFE,0x55,0xAA,0x55,0xAA,0x55,0xAA,0xFF,
          0xFF,0xFF,0x55,0xAA,0x55,0xAA,0x55,0xFF,0xFF};
          while(1){
          if(i<sizeof(effectP2)){
          P2=~effectP2[i];
          i++;
          }else{
          i=0;
          }

          if(j<sizeof(effectP0)){
          P0=~effectP0[j];
          j++;
          }else{
          j=0;
          }
          delay_ms(400);

          if(x<sizeof(border)){
          P1=~border[x];
          x++;
          }else{
          x=0;
          }
          delay_ms(800);
          }
          }

          ok rồi đó em.

          Comment


          • #6
            Nguyên văn bởi severfull5 Xem bài viết
            #include <REGx52.H>
            void delay_ms(unsigned char n)
            {
            unsigned char i,j;
            for(i=0;i<n;i++){
            for(j=0;j<120;j++){}
            }
            }

            void main(){
            // khai báo các bien dem hieu ung
            unsigned char i=0;
            unsigned char j=0;
            unsigned char x=0;
            //chay duong vien
            unsigned char code border[]={0xFE,0xFD,0xFB,0xF7,0xEF};
            unsigned char code effectP0[]={0xFF,0x00,0xFF,0x00,0xFE,0xFD,0xFB,0xF7,0xEF,0xD F,0xBF,0x7F,0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xF E,0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xB F, 0xDF,0xEF,0xF7,0xFB,0xFD,0xFE};
            unsigned char code effectP2[]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0x7E,0xB E,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,0xFE,0xFD,0xFB,
            0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xBF,0xDF,0xEF,0xF7, 0xFB,0xFD,0xFE,0x55,0xAA,0x55,0xAA,0x55,0xAA,0xFF,
            0xFF,0xFF,0x55,0xAA,0x55,0xAA,0x55,0xFF,0xFF};
            while(1){
            if(i<sizeof(effectP2)){
            P2=~effectP2[i];
            i++;
            }else{
            i=0;
            }

            if(j<sizeof(effectP0)){
            P0=~effectP0[j];
            j++;
            }else{
            j=0;
            }
            delay_ms(400);

            if(x<sizeof(border)){
            P1=~border[x];
            x++;
            }else{
            x=0;
            }
            delay_ms(800);
            }
            }

            ok rồi đó em.
            hit vẫn bị lỗi thế a ơi

            Comment


            • #7
              #include <REG52.H>
              #include <REGx52.H>
              void delay_ms(unsigned char n)
              {
              unsigned char i,j;
              for(i=0;i<n;i++){
              for(j=0;j<120;j++){}
              }
              }
              void main(){
              // khai báo các bien dem hieu ung
              unsigned char i=0;
              unsigned char j=0;
              unsigned char x=0;
              //chay duong vien
              unsigned char code border[]={0xFE,0xFD,0xFB,0xF7,0xEF};
              unsigned char code effectP0[]={0xFF,0x00,0xFF,0x00,0xFE,0xFD,0xFB,0xF7,0xEF,0xD F,0xBF,0x7F,0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xF

              E,0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xB F, 0xDF,0xEF,0xF7,0xFB,0xFD,0xFE};
              unsigned char code effectP2[]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0x7E,0xB E,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,0xFE,0xFD,0xFB,
              0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xBF,0xDF,0xEF,0xF7, 0xFB,0xFD,0xFE,0x55,0xAA,0x55,0xAA,0x55,0xAA,0xFF,
              0xFF,0xFF,0x55,0xAA,0x55,0xAA,0x55,0xFF,0xFF};
              while(1)
              {
              if(i<sizeof(effectP2))
              {
              P2=~effectP2[i];
              i++;
              }
              else
              {
              i=0;
              }
              if(j<sizeof(effectP0))
              {
              P0=~effectP0[j];
              j++;
              }
              else
              {
              j=0;
              }
              delay_ms(400);
              if(x<sizeof(border))
              {
              P1=~border[x];
              x++;
              }
              else
              {
              x=0;
              }
              delay_ms(800);
              }
              }


              như vậy đúng ko anh, e dịch bi lỗi
              Build target 'Target 1'
              compiling c++.c...
              C:\KEIL\C51\INC\ATMEL\REGX52.H(15): error C231: 'P0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(16): error C231: 'SP': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(17): error C231: 'DPL': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(18): error C231: 'DPH': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(19): error C231: 'PCON': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(20): error C231: 'TCON': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(21): error C231: 'TMOD': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(22): error C231: 'TL0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(23): error C231: 'TL1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(24): error C231: 'TH0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(25): error C231: 'TH1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(26): error C231: 'P1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(27): error C231: 'SCON': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(28): error C231: 'SBUF': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(29): error C231: 'P2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(30): error C231: 'IE': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(31): error C231: 'P3': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(32): error C231: 'IP': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(33): error C231: 'T2CON': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(35): error C231: 'RCAP2L': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(36): error C231: 'RCAP2H': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(37): error C231: 'TL2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(38): error C231: 'TH2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(39): error C231: 'PSW': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(40): error C231: 'ACC': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(41): error C231: 'B': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(70): error C231: 'IT0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(71): error C231: 'IE0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(72): error C231: 'IT1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(73): error C231: 'IE1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(74): error C231: 'TR0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(75): error C231: 'TF0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(76): error C231: 'TR1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(77): error C231: 'TF1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(106): error C231: 'T2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(107): error C231: 'T2EX': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(112): error C231: 'RI': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(113): error C231: 'TI': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(114): error C231: 'RB8': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(115): error C231: 'TB8': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(116): error C231: 'REN': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(117): error C231: 'SM2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(118): error C231: 'SM1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(119): error C231: 'SM0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(136): error C231: 'EX0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(137): error C231: 'ET0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(138): error C231: 'EX1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(139): error C231: 'ET1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(140): error C231: 'ES': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(141): error C231: 'ET2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(143): error C231: 'EA': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(157): error C231: 'RXD': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(158): error C231: 'TXD': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(159): error C231: 'INT0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(160): error C231: 'INT1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(161): error C231: 'T0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(162): error C231: 'T1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(163): error C231: 'WR': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(164): error C231: 'RD': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(169): error C231: 'PX0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(170): error C231: 'PT0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(171): error C231: 'PX1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(172): error C231: 'PT1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(173): error C231: 'PS': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(174): error C231: 'PT2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(179): error C231: 'CP_RL2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(180): error C231: 'C_T2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(181): error C231: 'TR2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(182): error C231: 'EXEN2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(183): error C231: 'TCLK': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(184): error C231: 'RCLK': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(185): error C231: 'EXF2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(186): error C231: 'TF2': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(197): error C231: 'P': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(199): error C231: 'OV': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(200): error C231: 'RS0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(201): error C231: 'RS1': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(202): error C231: 'F0': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(203): error C231: 'AC': redefinition
              C:\KEIL\C51\INC\ATMEL\REGX52.H(204): error C231: 'CY': redefinition
              C++.C(18): error C141: syntax error near 'F'
              C++.C(19): error C141: syntax error near 'E'
              C++.C(25): error C231: 'effect2': redefinition
              C++.C(25): error C141: syntax error near ')'
              C++.C(30): error C141: syntax error near 'else'
              C++.C(33): error C141: syntax error near '}'
              C++.C(34): error C141: syntax error near '<', expected ')'
              C++.C(34): error C129: missing ';' before ')'
              Target not created

              Comment


              • #8
                #include <REG52.H>
                #include <REGx52.H>
                #define XUNG P1_0 //LAY XUNG TU 555
                void delay()
                {
                while(XUNG==1)
                {
                }
                while(XUNG==0)
                {
                }
                }
                void main(){
                // khai báo các bien dem hieu ung
                unsigned char i=0;
                unsigned char j=0;
                unsigned char x=0;
                //chay duong vien
                unsigned char code border[]={0xFE,0xFD,0xFB,0xF7,0xEF};
                unsigned char code effect0[]={0xFF,0x00,0xFF,0x00,0xFE,0xFD,0xFB,0xF7,0xEF,0xD F,0xBF,0x7F,0x7F,
                0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0xFE,0xFD,0xFB, 0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xBF, 0xDF,0xEF,0xF7,0xFB,0xFD,0xFE};
                unsigned char code effect2[]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0x7E,0xB E,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,0xFE,0xFD,0xFB,
                0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xBF,0xDF,0xEF,0xF7, 0xFB,0xFD,0xFE,0x55,0xAA,0x55,0xAA,0x55,0xAA,0xFF,
                0xFF,0xFF,0x55,0xAA,0x55,0xAA,0x55,0xFF,0xFF};
                while(1)
                {
                if(i<sizeof(effect2))
                {
                P2=~effect2[i];
                i++;
                }
                else
                {
                i=0;
                }
                if(j<sizeof(effect0))
                {
                P0=~effect0[j];
                j++;
                }
                else
                {
                j=0;
                }
                delay();
                if(x<sizeof(border))
                {
                P1=~border[x];
                x++;
                }
                else
                {
                x=0;
                }
                delay();
                }
                }


                SAU KHI SỮA THÌ LẠI BÁO LỖI THẾ NÀY HIT HTI

                Build target 'Target 1'
                compiling c++.c...
                C:\KEIL\C51\INC\ATMEL\REGX52.H(15): error C231: 'P0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(16): error C231: 'SP': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(17): error C231: 'DPL': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(18): error C231: 'DPH': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(19): error C231: 'PCON': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(20): error C231: 'TCON': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(21): error C231: 'TMOD': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(22): error C231: 'TL0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(23): error C231: 'TL1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(24): error C231: 'TH0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(25): error C231: 'TH1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(26): error C231: 'P1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(27): error C231: 'SCON': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(28): error C231: 'SBUF': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(29): error C231: 'P2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(30): error C231: 'IE': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(31): error C231: 'P3': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(32): error C231: 'IP': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(33): error C231: 'T2CON': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(35): error C231: 'RCAP2L': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(36): error C231: 'RCAP2H': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(37): error C231: 'TL2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(38): error C231: 'TH2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(39): error C231: 'PSW': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(40): error C231: 'ACC': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(41): error C231: 'B': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(70): error C231: 'IT0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(71): error C231: 'IE0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(72): error C231: 'IT1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(73): error C231: 'IE1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(74): error C231: 'TR0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(75): error C231: 'TF0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(76): error C231: 'TR1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(77): error C231: 'TF1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(106): error C231: 'T2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(107): error C231: 'T2EX': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(112): error C231: 'RI': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(113): error C231: 'TI': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(114): error C231: 'RB8': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(115): error C231: 'TB8': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(116): error C231: 'REN': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(117): error C231: 'SM2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(118): error C231: 'SM1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(119): error C231: 'SM0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(136): error C231: 'EX0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(137): error C231: 'ET0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(138): error C231: 'EX1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(139): error C231: 'ET1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(140): error C231: 'ES': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(141): error C231: 'ET2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(143): error C231: 'EA': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(157): error C231: 'RXD': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(158): error C231: 'TXD': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(159): error C231: 'INT0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(160): error C231: 'INT1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(161): error C231: 'T0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(162): error C231: 'T1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(163): error C231: 'WR': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(164): error C231: 'RD': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(169): error C231: 'PX0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(170): error C231: 'PT0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(171): error C231: 'PX1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(172): error C231: 'PT1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(173): error C231: 'PS': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(174): error C231: 'PT2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(179): error C231: 'CP_RL2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(180): error C231: 'C_T2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(181): error C231: 'TR2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(182): error C231: 'EXEN2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(183): error C231: 'TCLK': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(184): error C231: 'RCLK': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(185): error C231: 'EXF2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(186): error C231: 'TF2': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(197): error C231: 'P': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(199): error C231: 'OV': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(200): error C231: 'RS0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(201): error C231: 'RS1': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(202): error C231: 'F0': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(203): error C231: 'AC': redefinition
                C:\KEIL\C51\INC\ATMEL\REGX52.H(204): error C231: 'CY': redefinition
                Target not created

                Comment


                • #9
                  cuối cùng e đã dịch được. mà choe hỏi thêm là muốn quét led từ p0=>P2.7 thi phải lam sao anh
                  #include <regx51.h>
                  #define XUNG P3_0 //LAY XUNG TU 555
                  void delay()
                  {
                  while(XUNG==1)
                  {
                  }
                  while(XUNG==0)
                  {
                  }
                  }
                  void main(){
                  // khai báo các bien dem hieu ung
                  unsigned char i=0;
                  unsigned char j=0;
                  unsigned char x=0;
                  //chay duong vien
                  unsigned char code border[]={0xFE,0xFD,0xFB,0xF7};
                  unsigned char code effect0[]={0xFF,0x00,0xFF,0x00,0xFE,0xFD,0xFB,0xF7,0xEF,0xD F,0xBF,0x7F,0x7F,
                  0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0xFE,0xFD,0xFB, 0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xBF, 0xDF,0xEF,0xF7,0xFB,0xFD,0xFE};
                  unsigned char code effect2[]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0x7E,0xB E,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,0xFE,0xFD,0xFB,
                  0xF7,0xEF,0xDF,0xBF,0x7F,0x7F,0xBF,0xDF,0xEF,0xF7, 0xFB,0xFD,0xFE,0x55,0xAA,0x55,0xAA,0x55,0xAA,0xFF,
                  0xFF,0xFF,0x55,0xAA,0x55,0xAA,0x55,0xFF,0xFF};
                  while(1)
                  {
                  if(i<sizeof(effect2))
                  {
                  P2=~effect2[i];
                  i++;
                  }
                  else
                  {
                  i=0;
                  }
                  if(j<sizeof(effect0))
                  {
                  P0=~effect0[j];
                  j++;
                  }
                  else
                  {
                  j=0;
                  }
                  delay();
                  if(x<sizeof(border))
                  {
                  P1=~border[x];
                  x++;
                  }
                  else
                  {
                  x=0;
                  }
                  delay();
                  }
                  }

                  Comment


                  • #10
                    mấy anh giúp e với......

                    Comment


                    • #11
                      dùng vòng for bt thôi bạn. cho nó chạy hết p0 rồi sang p2
                      Nguyễn Huy Biên - 01649 802 694
                      gmail :

                      Comment


                      • #12
                        cụ thể thế nào giúp dùm code cho e với làm mãi mà vẫn trơ trơ ah

                        Comment


                        • #13
                          mong mấy bác hồi âm sớm

                          Comment


                          • #14
                            Cái này bạn dùng điều khiển led đơn à??
                            vanduc0211@gmail.com

                            Comment


                            • #15
                              dạ dùng quét led đơn ạ.

                              Comment

                              Về tác giả

                              Collapse

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

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

                              Collapse

                              Đang tải...
                              X