專注電子技術(shù)學(xué)習(xí)與研究
當(dāng)前位置:單片機(jī)教程網(wǎng) >> MCU設(shè)計(jì)實(shí)例 >> 瀏覽文章

51單片機(jī):8x8點(diǎn)陣顯示心形圖案

作者:佚名   來源:本站原創(chuàng)   點(diǎn)擊數(shù):  更新時(shí)間:2011年11月18日   【字體:

單片機(jī)開發(fā)板是自己做的,電路很簡單8*8點(diǎn)陣的行和列分別接在單片機(jī)的p0口和p1口,p0口記得要上拉電阻哦,我測(cè)試成功見圖片,

 


#include <reg52.H>
unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code graph[]={0x30,0x48,0x44,0x22,0x44,0x48,0x30,0x00};
unsigned char cnta;
void main(void)
{
unsigned int i,j;
 TMOD=0x01;
 TH0=(65536-2000)/256;
 TL0=(65536-2000)%256;
 TR0=1;
 ET0=1;
 EA=1;
while(1)
   {
   }
}
void t0(void) interrupt 1 using 0
{
TH0=(65536-2000)/256;
TL0=(65536-2000)%256;
P1=tab[cnta];
P0=graph[cnta];
cnta++;
if(cnta==8)
  {
   cnta=0;
  }
}
關(guān)閉窗口

相關(guān)文章