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

QQ登錄

只需一步,快速開始

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

剛剛寫完的16*64點(diǎn)陣驅(qū)動(dòng),不為最佳方案,請(qǐng)高手指教、供初學(xué)者學(xué)習(xí)

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:51090 發(fā)表于 2014-9-18 00:22 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
#include<reg51.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
sbit SERIN=P2^3;
sbit SRCK=P2^1;
sbit RCK1=P2^0;
sbit G1OUT=P2^7; //+
sbit G2OUT=P2^2; //-
sbit AOUT=P2^4;
sbit BOUT=P2^5;
sbit COUT=P2^6;
uchar code table[4][128]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x06,0x40,0x38,0x50,0x08,0x48,0x08,0x48,0x08,0x40,0xFF,0xFE,0x08,0x40,0x08,0x48,0x0E,0x28,0x38,0x30,0xC8,0x20,0x08,0x50,0x09,0x92,0x08,0x0A,0x28,0x06,0x10,0x02,//我
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   },
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x22,0x20,0x22,0x20,0xFF,0xA0,0x22,0x20,0x3E,0xFC,0x08,0x24,0x7F,0x24,0x49,0x24,0x49,0x24,0x7F,0x24,0x08,0x24,0xFF,0x44,0x08,0x44,0x08,0x94,0x09,0x08,0x08,0x00,//勒
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   },
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x40,0x04,0x20,0x09,0x18,0x11,0x0E,0x61,0x04,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,//個(gè)
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   },
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x01,0x00,0x01,0x00,0x3F,0xFC,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x7F,0xFE,0x02,0x00,0x06,0x00,0x08,0x20,0x10,0x10,0x3F,0xF8,0x10,0x10,0x00,0x00,//去
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   },
};
void delay1(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=10;y>0;y--);
}

void send(uchar byte)
{
  uchar i=8;
  while(i--)
  {
    SRCK =0;   
    SERIN=(byte&0x80);
    byte<<=1;
   SRCK =1;
  }
  
}
void sendb(uchar bite)
{
  while(bite--)
  {
    SRCK =0;   
    SERIN=0;
   SRCK =1;
  }
}

void OutPut(uchar k)
{
  RCK1=0;
  RCK1=1;
  RCK1=0;
  delay1(k);

}
void lost()
{  
uchar i=64;
OutPut(10);
while(i--)
{
  SRCK =0;
  SERIN=0;
  SRCK =1;
}
OutPut(0);

}
void main(void)
{
uint a, b,c,d,e;
EA=1;
ET0=1;
TMOD=0x02;
TH0=56;
TR0=1;
G2OUT=0;
while(1)
{  
  for(a=0;a<32;a++)
  {
  if(a%16==0)e=40;
    else e=4;
  while(e--)
  {
   for(b=0;b<16;b++)
   {
   for(c=0;c<4;c++)
  {
   for(d=0;d<2;d++)
  {
         send(table[c][2*b+d+a*2]);
   
  }
  }
   if(a>16)sendb(a);
   G1OUT=b/8;
   AOUT=0x01&b;
      BOUT=0x02&b;
      COUT=0x04&b;
   lost();
   }

   }
  }
}

}
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏3 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:43559 發(fā)表于 2015-1-19 05:24 | 只看該作者
感謝分享。
回復(fù)

使用道具 舉報(bào)

板凳
ID:107781 發(fā)表于 2016-4-2 22:01 | 只看該作者
怎樣實(shí)現(xiàn)右移動(dòng)?8個(gè)595如何從低到高列掃描?
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

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

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

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