Tình hình là em đang làm cái led cube nhưng khi em lập trình hiệu ứng các số 3,2,1 quay 360 độ và đếm lùi thì báo lỗi " auto segment too large " code của em như thế này
#include<reg52.h>
#include<intrins.h>
#include<stdlib.h>
#include<stdio.h>
sbit lop1=P0^0;
sbit lop2=P0^1;
sbit lop3=P0^2;
sbit lop4=P0^3;
sbit lop5=P0^4;
sbit c1 = P1^0;
sbit c2 = P1^1;
sbit c3 = P1^2;
sbit c4 = P1^3;
sbit c5 = P1^4;
sbit c6 = P1^5;
sbit c7 = P1^6;
sbit c8 = P1^7;
sbit c9 = P3^7;
sbit c10 = P3^6;
sbit c11 = P3^5;
sbit c12 = P3^4;
sbit c13 = P3^3;
sbit c14 = P3^2;
sbit c15 = P3^1;
sbit c16 = P3^0;
sbit c17 = P2^0;
sbit c18 = P2^1;
sbit c19 = P2^2;
sbit c20 = P2^3;
sbit c21 = P2^4;
sbit c22 = P2^5;
sbit c23 = P2^6;
sbit c24 = P2^7;
sbit c25 = P0^5;
void delay(unsigned int t)
{
int i;
for(i=0;i<=t;i++);
}
//______________________________________//
void _3_21(void)
{
unsigned int i,j,k;
unsigned char quet[5]={0xfe,0xfd,0xfb,0xf7,0xef};
unsigned char M[27][5] = {{0xff,0xff,0xff,0xff,0xff},
{0xbf,0xef,0xbf,0xef,0xbf},
{0x7f,0xfb,0xef,0xfb,0x7f},
{0xff,0xfe,0xff,0xfe,0xff}, //co cot 25
{0xff,0xff,0xff,0xff,0xff},
{0xbf,0xef,0xff,0xef,0xbf},
{0x7f,0xfb,0xff,0xfb,0x7f},
{0xff,0xfe,0xff,0xfe,0xff}, //co cot 25
{0xff,0xff,0xff,0xff,0xff},
// So 2//
{0xff,0xff,0xff,0xff,0xff},
{0xbf,0xef,0xbf,0xff,0xaf},
{0x7f,0xfb,0xef,0xff,0x7b},
{0xff,0xfe,0xff,0xff,0xfe}, //co cot 25
{0xff,0xff,0xff,0xff,0xff},
{0xbf,0xef,0xff,0xbf,0xaf},
{0x7f,0xfb,0xff,0x7f,0x7b},
{0xff,0xfe,0xff,0x7f,0xfe}, // co cot 25
{0xff,0xff,0xff,0xff,0xff},
// So 1//
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xff,0xff,0xff,0xbf},
{0xff,0xff,0xff,0xff,0x7f},
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xbf,0xff,0xff,0xbf},
{0xff,0x7f,0xff,0xff,0x7f},
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xff,0xff,0xff,0xff}};
unsigned char N[27][5] ={{0xff,0xff,0xff,0xff,0xff},
{0xfb,0xef,0xff,0xef,0xfb},
{0xfd,0xbf,0xff,0xbf,0xfd},
{0xfe,0xff,0xff,0xff,0xfe}, // co cot 25
{0xff,0xff,0xff,0xff,0xff},
{0xfb,0xef,0xfb,0xef,0xfb},
{0xfd,0xbf,0xfd,0xbf,0xfd},
{0xfe,0xff,0xfe,0xff,0xfe}, // co cot 25
{0xff,0xff,0xff,0xff,0xff},
// SO 2//
{0xff,0xff,0xff,0xff,0xff},
{0xfb,0xef,0xff,0xfb,0xeb},
{0xfd,0xbf,0xff,0xfd,0xbd},
{0xfe,0xff,0xff,0xfe,0xfe}, // co cot 25
{0xff,0xff,0xff,0xff,0xff},
{0xfb,0xef,0xfb,0xff,0xeb},
{0xfd,0xbf,0xfd,0xff,0xbd},
{0xfe,0xff,0xfe,0xff,0xfe},// co cot 25
{0xff,0xff,0xff,0xff,0xff},
//So 1//
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xfb,0xff,0xff,0xfb},
{0xff,0xfd,0xff,0xff,0xfd},
{0xff,0xfe,0xff,0xff,0xfe},
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xff,0xff,0xff,0xfb},
{0xff,0xff,0xff,0xff,0xfd},
{0xff,0xff,0xff,0xff,0xfe},
{0xff,0xff,0xff,0xff,0xff}};
unsigned char L[27][5] ={{0xe3,0xdd,0xf3,0xdd,0xe3},
{0xf7,0xff,0xf7,0xff,0xf7},
{0xf7,0xff,0xf7,0xff,0xf7},
{0x77,0xff,0x77,0xff,0x77}, // co cot 25
{0xe3,0xdd,0xe7,0xdd,0xe3},
{0xf7,0xff,0xf7,0xff,0xf7},
{0xf7,0xff,0xf7,0xff,0xf7},
{0x77,0xff,0xf7,0xff,0x77}, // co cot 25
{0xe3,0xdd,0xf3,0xdd,0xe3},
// So 2//
{0xe3,0xdd,0xf3,0xef,0xc1},
{0xf7,0xff,0xf7,0xff,0xf7},
{0xf7,0xff,0xf7,0xff,0xf7},
{0x77,0xff,0x77,0xff,0x77}, // co cot 25
{0xe3,0xdd,0xe7,0xfb,0xc1},
{0xf7,0xff,0xf7,0xff,0xf7},
{0xf7,0xff,0xf7,0xff,0xf7},
{0x77,0xff,0xf7,0xff,0x77}, // co cot 25
{0xe3,0xdd,0xf3,0xef,0xc1},
//So 1//
{0xf7,0xe7,0xf7,0xf7,0xe3},
{0xf7,0xf7,0xf7,0xf7,0xf7},
{0xf7,0xf7,0xf7,0xf7,0xf7},
{0xf7,0xf7,0xf7,0xf7,0x77},
{0xf7,0xf3,0xf7,0xf7,0xe3},
{0xf7,0xf7,0xf7,0xf7,0xf7},
{0xf7,0xf7,0xf7,0xf7,0xf7},
{0xf7,0x77,0xf7,0xf7,0x77},
{0xf7,0xe7,0xf7,0xf7,0xe3}};
for(i=0;i<=26;i++)
{
for(k=0;k<=500;k++) // vong lap tao tre//
{
for(j=0;j<=4;j++)
{
P0= quet[j];
P1= M[i][j];
P2= N[i][j];
P3= L[i][j];
if((i==3&&j==1)||(i==3&&j==3)||(i==7&&j==1)||(i==7 &&j==3)||(i=12&&j==1)||(i==12&&j==4)||(i==16&&j==1 )||(i==16&&j==4))
c25=0;
else c25=1;
delay(2);
}
}
}
}
void main(void)
{
while(1)
{
_3_21();
}
}
pro nào vào giải thích giúp em với
#include<reg52.h>
#include<intrins.h>
#include<stdlib.h>
#include<stdio.h>
sbit lop1=P0^0;
sbit lop2=P0^1;
sbit lop3=P0^2;
sbit lop4=P0^3;
sbit lop5=P0^4;
sbit c1 = P1^0;
sbit c2 = P1^1;
sbit c3 = P1^2;
sbit c4 = P1^3;
sbit c5 = P1^4;
sbit c6 = P1^5;
sbit c7 = P1^6;
sbit c8 = P1^7;
sbit c9 = P3^7;
sbit c10 = P3^6;
sbit c11 = P3^5;
sbit c12 = P3^4;
sbit c13 = P3^3;
sbit c14 = P3^2;
sbit c15 = P3^1;
sbit c16 = P3^0;
sbit c17 = P2^0;
sbit c18 = P2^1;
sbit c19 = P2^2;
sbit c20 = P2^3;
sbit c21 = P2^4;
sbit c22 = P2^5;
sbit c23 = P2^6;
sbit c24 = P2^7;
sbit c25 = P0^5;
void delay(unsigned int t)
{
int i;
for(i=0;i<=t;i++);
}
//______________________________________//
void _3_21(void)
{
unsigned int i,j,k;
unsigned char quet[5]={0xfe,0xfd,0xfb,0xf7,0xef};
unsigned char M[27][5] = {{0xff,0xff,0xff,0xff,0xff},
{0xbf,0xef,0xbf,0xef,0xbf},
{0x7f,0xfb,0xef,0xfb,0x7f},
{0xff,0xfe,0xff,0xfe,0xff}, //co cot 25
{0xff,0xff,0xff,0xff,0xff},
{0xbf,0xef,0xff,0xef,0xbf},
{0x7f,0xfb,0xff,0xfb,0x7f},
{0xff,0xfe,0xff,0xfe,0xff}, //co cot 25
{0xff,0xff,0xff,0xff,0xff},
// So 2//
{0xff,0xff,0xff,0xff,0xff},
{0xbf,0xef,0xbf,0xff,0xaf},
{0x7f,0xfb,0xef,0xff,0x7b},
{0xff,0xfe,0xff,0xff,0xfe}, //co cot 25
{0xff,0xff,0xff,0xff,0xff},
{0xbf,0xef,0xff,0xbf,0xaf},
{0x7f,0xfb,0xff,0x7f,0x7b},
{0xff,0xfe,0xff,0x7f,0xfe}, // co cot 25
{0xff,0xff,0xff,0xff,0xff},
// So 1//
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xff,0xff,0xff,0xbf},
{0xff,0xff,0xff,0xff,0x7f},
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xbf,0xff,0xff,0xbf},
{0xff,0x7f,0xff,0xff,0x7f},
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xff,0xff,0xff,0xff}};
unsigned char N[27][5] ={{0xff,0xff,0xff,0xff,0xff},
{0xfb,0xef,0xff,0xef,0xfb},
{0xfd,0xbf,0xff,0xbf,0xfd},
{0xfe,0xff,0xff,0xff,0xfe}, // co cot 25
{0xff,0xff,0xff,0xff,0xff},
{0xfb,0xef,0xfb,0xef,0xfb},
{0xfd,0xbf,0xfd,0xbf,0xfd},
{0xfe,0xff,0xfe,0xff,0xfe}, // co cot 25
{0xff,0xff,0xff,0xff,0xff},
// SO 2//
{0xff,0xff,0xff,0xff,0xff},
{0xfb,0xef,0xff,0xfb,0xeb},
{0xfd,0xbf,0xff,0xfd,0xbd},
{0xfe,0xff,0xff,0xfe,0xfe}, // co cot 25
{0xff,0xff,0xff,0xff,0xff},
{0xfb,0xef,0xfb,0xff,0xeb},
{0xfd,0xbf,0xfd,0xff,0xbd},
{0xfe,0xff,0xfe,0xff,0xfe},// co cot 25
{0xff,0xff,0xff,0xff,0xff},
//So 1//
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xfb,0xff,0xff,0xfb},
{0xff,0xfd,0xff,0xff,0xfd},
{0xff,0xfe,0xff,0xff,0xfe},
{0xff,0xff,0xff,0xff,0xff},
{0xff,0xff,0xff,0xff,0xfb},
{0xff,0xff,0xff,0xff,0xfd},
{0xff,0xff,0xff,0xff,0xfe},
{0xff,0xff,0xff,0xff,0xff}};
unsigned char L[27][5] ={{0xe3,0xdd,0xf3,0xdd,0xe3},
{0xf7,0xff,0xf7,0xff,0xf7},
{0xf7,0xff,0xf7,0xff,0xf7},
{0x77,0xff,0x77,0xff,0x77}, // co cot 25
{0xe3,0xdd,0xe7,0xdd,0xe3},
{0xf7,0xff,0xf7,0xff,0xf7},
{0xf7,0xff,0xf7,0xff,0xf7},
{0x77,0xff,0xf7,0xff,0x77}, // co cot 25
{0xe3,0xdd,0xf3,0xdd,0xe3},
// So 2//
{0xe3,0xdd,0xf3,0xef,0xc1},
{0xf7,0xff,0xf7,0xff,0xf7},
{0xf7,0xff,0xf7,0xff,0xf7},
{0x77,0xff,0x77,0xff,0x77}, // co cot 25
{0xe3,0xdd,0xe7,0xfb,0xc1},
{0xf7,0xff,0xf7,0xff,0xf7},
{0xf7,0xff,0xf7,0xff,0xf7},
{0x77,0xff,0xf7,0xff,0x77}, // co cot 25
{0xe3,0xdd,0xf3,0xef,0xc1},
//So 1//
{0xf7,0xe7,0xf7,0xf7,0xe3},
{0xf7,0xf7,0xf7,0xf7,0xf7},
{0xf7,0xf7,0xf7,0xf7,0xf7},
{0xf7,0xf7,0xf7,0xf7,0x77},
{0xf7,0xf3,0xf7,0xf7,0xe3},
{0xf7,0xf7,0xf7,0xf7,0xf7},
{0xf7,0xf7,0xf7,0xf7,0xf7},
{0xf7,0x77,0xf7,0xf7,0x77},
{0xf7,0xe7,0xf7,0xf7,0xe3}};
for(i=0;i<=26;i++)
{
for(k=0;k<=500;k++) // vong lap tao tre//
{
for(j=0;j<=4;j++)
{
P0= quet[j];
P1= M[i][j];
P2= N[i][j];
P3= L[i][j];
if((i==3&&j==1)||(i==3&&j==3)||(i==7&&j==1)||(i==7 &&j==3)||(i=12&&j==1)||(i==12&&j==4)||(i==16&&j==1 )||(i==16&&j==4))
c25=0;
else c25=1;
delay(2);
}
}
}
}
void main(void)
{
while(1)
{
_3_21();
}
}
pro nào vào giải thích giúp em với
Comment