8*8点阵怎么样才能左右移动?
1个回答
展开全部
假如现实以下的字形,对应的数组如 a[8] = {0x01,0x02,0x02,0x03,0x40,0x40};
当实现循环左移时,将a[i+1]的值赋给a[i];将a[0]赋给a[7];当然说的不大清楚 给你个例子:
#define LEDPORT P1
unsigned char a[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
unsigned char i = 0;
unsigned char j = 0;
unsigned char k = 0;
for(i=0; i<8; i++)
{
for (j=0; j<8; j++)
{
if (j+i >= 8)
{
LEDPORT = a[k++];
}
else
{
LEDPORT = a[j+i];
}
delay();
}
}
当实现循环左移时,将a[i+1]的值赋给a[i];将a[0]赋给a[7];当然说的不大清楚 给你个例子:
#define LEDPORT P1
unsigned char a[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
unsigned char i = 0;
unsigned char j = 0;
unsigned char k = 0;
for(i=0; i<8; i++)
{
for (j=0; j<8; j++)
{
if (j+i >= 8)
{
LEDPORT = a[k++];
}
else
{
LEDPORT = a[j+i];
}
delay();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询