找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 2761|回復(fù): 1
打印 上一主題 下一主題
收起左側(cè)

8*8LED仿真proteus遇到問(wèn)題了,求大神指導(dǎo)!

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
8*8LED仿真proteus遇到問(wèn)題了,求大神指導(dǎo)。  如下代碼能正常顯示一個(gè)張字,可是不想用ord數(shù)組,直接利用oxfe悠移動(dòng)與0x01或運(yùn)算得出控制行標(biāo),(用程序中//后的代替該行,最后補(bǔ)p=(p<<1)|0x01;)反而沒(méi)有結(jié)果,求賜交。!



#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;
}
}
   
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:187614 發(fā)表于 2017-4-10 10:20 | 只看該作者
上午調(diào)了一下,字是左右鏡像的,你把它反過(guò)來(lái)就行。主要是送的數(shù)據(jù)有點(diǎn)問(wèn)題。
#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);

        }
}
}
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表