ko biết em viết code sai ở đâu mà sao chữ nó chạy theo hình tròn z mấy bác
sửa 2 ngày nay rồi mà ko đc
phần cứng em nối vào p1dùng ngắt 0
mong đc sự hướng dẫn nhiết tình của mấy bác
#include <at89x52.h>
unsigned char j,buoc=0;
unsigned int k=0,i=0;
code unsigned int mang1[]={ 0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0x1,0x0EF,0x0EF,0x0EF,0x1,0x0FF, //h
0x7,0x0EB,0x0ED,0x0EB,0x7,0x0FF, //a
0x83,0x7D,0x7D,0x7D,0x83,0x0FF, //0
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0x7,0x0EB,0x0ED,0x0EB,0x7,0x0FF, //a
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x7,0x0EB,0x0ED,0x0EB,0x7,0x0FF, //a
0x1,0x0F7,0x0EF,0x0DF,0x1,0x0FF, //n
0x1,0x0EF,0x0EF,0x0EF,0x1,0x0FF, //h
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x6D,0x6D,0x6D,0x6D,0x0FF, //e
0x1,0x0FB,0x0F7,0x0FB,0x1,0x0FF, //m
0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x0EF,0x0D7,0x0BB,0x7D,0x0FF, //k
0x71,0x75,0x75,0x75,0x8D,0x0FF, //5
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0x83,0x7D,0x7D,0x7D,0x83,0x0FF, //0
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x6D,0x6D,0x7D,0x83,0x0FF, //dd
0x1,0x0FF, //i
0x1,0x6D,0x6D,0x6D,0x6D,0x0FF, //e
0x1,0x0F7,0x0EF,0x0DF,0x1,0x0FF, //n
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0FD,0x0FD,0x1,0x0FD,0x0FD,0x0FF, //t
0x81,0x7F,0x7F,0x7F,0x81,0x0FF, //u
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0x1,0x0EF,0x0EF,0x0EF,0x1,0x0FF, //h
0x81,0x7F,0x7F,0x7F,0x81,0x0FF, //u
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x7,0x0EB,0x0ED,0x0EB,0x7,0x0FF, //a
0x1,0x0F7,0x0EF,0x0DF,0x1,0x0FF, //n
0x1,0x0EF,0x0EF,0x0EF,0x1,0x0FF, //h
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x6D,0x6D,0x6D,0x6D,0x0FF, //e
0x1,0x0FB,0x0F7,0x0FB,0x1,0x0FF, //m
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x0EF,0x0EF,0x0EF,0x1,0x0FF, //h
0x83,0x7D,0x7D,0x7D,0x83,0x0FF, //0
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x75,0x75,0x75,0x75,0x8B,0x0FF, //b
0x7,0x0EB,0x0ED,0x0EB,0x7,0x0FF, //a
0x1,0x0FF, //i
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0C1,0x0BF,0x7F,0x7F,0x0BF,0x0C1,0x0FF, //v
0x81,0x7F,0x7F,0x7F,0x81,0x0FF, //u
0x1,0x0FF, //i//i
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0C1,0x0BF,0x7F,0x7F,0x0BF,0x0C1,0x0FF, //v
0x1,0x6D,0x6D,0x6D,0x6D,0x0FF, //e
0x0F7,0x0FB,0x0FD,0x0FB,0x0F7,0x0BF,0x0F7,0x0FB,0x 0FD,0x0FB,0x0F7, // ^.^ //399
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff
};
void ISR0 (void) interrupt 0 using 2
{
for(i=0;i<(120+k);i++)
{
j=20;
while(j--)
{
P1=mang1[i];
}
}
P1=0xff;
buoc++; //cho chu hien thi lau 1chut
if(buoc==3)k++,buoc=0;
if(k==399)k=0;
}
//================================================== =====================================
void main()
{
P2=0xff;
P1=0xff;
EA=1;
EX0=1;
P3_0=0;
while(1)
{}
}
sửa 2 ngày nay rồi mà ko đc
phần cứng em nối vào p1dùng ngắt 0
mong đc sự hướng dẫn nhiết tình của mấy bác
#include <at89x52.h>
unsigned char j,buoc=0;
unsigned int k=0,i=0;
code unsigned int mang1[]={ 0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0x1,0x0EF,0x0EF,0x0EF,0x1,0x0FF, //h
0x7,0x0EB,0x0ED,0x0EB,0x7,0x0FF, //a
0x83,0x7D,0x7D,0x7D,0x83,0x0FF, //0
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0x7,0x0EB,0x0ED,0x0EB,0x7,0x0FF, //a
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x7,0x0EB,0x0ED,0x0EB,0x7,0x0FF, //a
0x1,0x0F7,0x0EF,0x0DF,0x1,0x0FF, //n
0x1,0x0EF,0x0EF,0x0EF,0x1,0x0FF, //h
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x6D,0x6D,0x6D,0x6D,0x0FF, //e
0x1,0x0FB,0x0F7,0x0FB,0x1,0x0FF, //m
0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x0EF,0x0D7,0x0BB,0x7D,0x0FF, //k
0x71,0x75,0x75,0x75,0x8D,0x0FF, //5
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0x83,0x7D,0x7D,0x7D,0x83,0x0FF, //0
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x6D,0x6D,0x7D,0x83,0x0FF, //dd
0x1,0x0FF, //i
0x1,0x6D,0x6D,0x6D,0x6D,0x0FF, //e
0x1,0x0F7,0x0EF,0x0DF,0x1,0x0FF, //n
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0FD,0x0FD,0x1,0x0FD,0x0FD,0x0FF, //t
0x81,0x7F,0x7F,0x7F,0x81,0x0FF, //u
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0x1,0x0EF,0x0EF,0x0EF,0x1,0x0FF, //h
0x81,0x7F,0x7F,0x7F,0x81,0x0FF, //u
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x7,0x0EB,0x0ED,0x0EB,0x7,0x0FF, //a
0x1,0x0F7,0x0EF,0x0DF,0x1,0x0FF, //n
0x1,0x0EF,0x0EF,0x0EF,0x1,0x0FF, //h
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x6D,0x6D,0x6D,0x6D,0x0FF, //e
0x1,0x0FB,0x0F7,0x0FB,0x1,0x0FF, //m
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x0EF,0x0EF,0x0EF,0x1,0x0FF, //h
0x83,0x7D,0x7D,0x7D,0x83,0x0FF, //0
0x83,0x7D,0x7D,0x7D,0x7D,0x0FF, //c
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x1,0x75,0x75,0x75,0x75,0x8B,0x0FF, //b
0x7,0x0EB,0x0ED,0x0EB,0x7,0x0FF, //a
0x1,0x0FF, //i
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0C1,0x0BF,0x7F,0x7F,0x0BF,0x0C1,0x0FF, //v
0x81,0x7F,0x7F,0x7F,0x81,0x0FF, //u
0x1,0x0FF, //i//i
0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0C1,0x0BF,0x7F,0x7F,0x0BF,0x0C1,0x0FF, //v
0x1,0x6D,0x6D,0x6D,0x6D,0x0FF, //e
0x0F7,0x0FB,0x0FD,0x0FB,0x0F7,0x0BF,0x0F7,0x0FB,0x 0FD,0x0FB,0x0F7, // ^.^ //399
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff
};
void ISR0 (void) interrupt 0 using 2
{
for(i=0;i<(120+k);i++)
{
j=20;
while(j--)
{
P1=mang1[i];
}
}
P1=0xff;
buoc++; //cho chu hien thi lau 1chut
if(buoc==3)k++,buoc=0;
if(k==399)k=0;
}
//================================================== =====================================
void main()
{
P2=0xff;
P1=0xff;
EA=1;
EX0=1;
P3_0=0;
while(1)
{}
}
Comment