写的51单片机控制点阵程序,无法取得预期效果,哪位大神帮我看下问题出在哪里 20
//程序欲实现的功能是8x8点阵滚动显示“I爱心u”,点阵列选位接P0口低电平有效,行接P1口高电平有效#include<reg52.h>#include<intrins...
//程序欲实现的功能是8x8点阵滚动显示“I 爱心 u”,点阵列选位接P0口低电平有效,行接P1口高电平有效
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar code PP0[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar code sz[27][8]={
{0x00,0x81,0x81,0xFF,0xFF,0x81,0x81,0x00},
{…………………………………………………},//由于字数限制,数组代码中间省略
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}//动画帧27
};
sbit scq2=P2^7;
uchar num1,num2,num3;
void delay(uchar m)
{
uchar i,j;
for(i=m;i>0;i--)
for(j=110;j>0;j--);
}
void main()
{
scq2=0;
num1=0xfe;//列扫描的起始
while(1)
{ for(num3=0;num3<27;num3++)//动画帧递增选择
for(num2=0;num2<8;num2++)//列扫描
{
P0=num1;
P1=sz[num3][num2];
num1=_crol_(num1,1);//循环左移列选择
delay(5);
}
num1=_crol_(num1,1);//列扫描的起始左移一列
delay(50);
}
} 展开
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar code PP0[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar code sz[27][8]={
{0x00,0x81,0x81,0xFF,0xFF,0x81,0x81,0x00},
{…………………………………………………},//由于字数限制,数组代码中间省略
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}//动画帧27
};
sbit scq2=P2^7;
uchar num1,num2,num3;
void delay(uchar m)
{
uchar i,j;
for(i=m;i>0;i--)
for(j=110;j>0;j--);
}
void main()
{
scq2=0;
num1=0xfe;//列扫描的起始
while(1)
{ for(num3=0;num3<27;num3++)//动画帧递增选择
for(num2=0;num2<8;num2++)//列扫描
{
P0=num1;
P1=sz[num3][num2];
num1=_crol_(num1,1);//循环左移列选择
delay(5);
}
num1=_crol_(num1,1);//列扫描的起始左移一列
delay(50);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询