标题:
8*8LED仿真proteus遇到问题了,求大神指导!!
[打印本页]
作者:
c51hyw
时间:
2017-4-9 19:53
标题:
8*8LED仿真proteus遇到问题了,求大神指导!!
8*8LED仿真proteus遇到问题了,求大神指导!! 如下代码能正常显示一个张字,可是不想用ord数组,直接利用oxfe悠移动与0x01或运算得出控制行标,(用程序中//后的代替该行,最后补p=(p<<1)|0x01;)反而没有结果,求赐交!!!
XJS}J]4Y_8J@9$S7DJ4K2F3.png
(41.08 KB, 下载次数: 109)
下载附件
2017-4-9 19:52 上传
#include <reg51.h>
#include <intrins.h>
#define uchar unsigned char
sbit sh=P2^0;
sbit ds=P2^1;
sbit st=P2^2;
code TAB[]={0xE9,0x2A,0xEC,0x9F,0xEC,0x2A,0xED,0x00};
code ord[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void delay(int s)
{
int i;
for(i=0;i<s;i++)
{
_nop_();
_nop_();
_nop_();
}
}
void main()
{
uchar p=0xfe,q;
int i,j;
for(i=0;i<8;i++)
{
q=ord
;//q=p;
st=0;
for(j=0;j<8;j++)
{
q=q<<1;
ds=CY;
sh=0;
delay(1);
sh=1;
}
st=1;
P0=TAB
;
delay(10);
// p=(p<<1)|0x01;
}
}
作者:
51Lovers
时间:
2017-4-10 10:20
上午调了一下,字是左右镜像的,你把它反过来就行。主要是送的数据有点问题。
#include <reg51.h>
#include <intrins.h>
#define uchar unsigned char
sbit sh=P2^0;
sbit ds=P2^1;
sbit st=P2^2;
code TAB[]={0xE9,0x2A,0xEC,0x9F,0xEC,0x2A,0xED,0x00};
code ord[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void delay(char s)
{ char i;
for(i=0;i<s;i++)
{
_nop_();
_nop_();
_nop_();
}
}
void main()
{
uchar p=0xfe,q;
char i,j;
while(1)
{
for(i=0;i<8;i++)
{
q=ord[i];//q=p;
st=0;
for(j=0;j<8;j++)
{
q=q<<1;
ds=CY;
sh=0;
delay(1);
sh=1;
}
st=1;
P0=TAB[i];
delay(10);
delay(200);
}
}
}
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1