日本欧美一区-日本欧美一区二区三区片-日本强好片久久久久久AAA-日本-区一区二区三区A片-日本人伦一区二区三区-日本人妻A片成人免费看

電子開發(fā)網(wǎng)

電子開發(fā)網(wǎng)電子設(shè)計(jì) | 電子開發(fā)網(wǎng)Rss 2.0 會(huì)員中心 會(huì)員注冊(cè)
搜索: 您現(xiàn)在的位置: 電子開發(fā)網(wǎng) >> 電子開發(fā) >> 單片機(jī) >> 正文

單片機(jī)點(diǎn)陣式LED顯示技術(shù)數(shù)字“0-9”

作者:佚名    文章來源:本站原創(chuàng)    點(diǎn)擊數(shù):    更新時(shí)間:2011/10/12

1.實(shí)驗(yàn)任務(wù)
利用8X8點(diǎn)陣顯示數(shù)字0到9的數(shù)字。
2.電路原理圖
點(diǎn)陣式LED“0-9”數(shù)字顯示技術(shù)
                                                                                            圖4.25.1
3.硬件系統(tǒng)連線
(1).把“單片機(jī)系統(tǒng)”區(qū)域中的P1端口用8芯排芯連接到“點(diǎn)陣模塊”區(qū)域中的“DR1-DR8”端口上;
(2).把“單片機(jī)系統(tǒng)”區(qū)域中的P3端口用8芯排芯連接到“點(diǎn)陣模塊”區(qū)域中的“DC1-DC8”端口上;
4.程序設(shè)計(jì)內(nèi)容
(1).?dāng)?shù)字0-9點(diǎn)陣顯示代碼的形成
  如下圖所示,假設(shè)顯示數(shù)字“0”
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00 00  3E  41  41  41  3E 00
  因此,形成的列代碼為 00H,00H,3EH,41H,41H,3EH,00H,00H;只要把這些代碼分別送到相應(yīng)的列線上面,即可實(shí)現(xiàn)“0”的數(shù)字顯示。
  送顯示代碼過程如下所示
  送第一列線代碼到P3端口,同時(shí)置第一行線為“0”,其它行線為“1”,延時(shí)2ms左右,送第二列線代碼到P3端口,同時(shí)置第二行線為“0”,其它行線為“1”,延時(shí)2ms左右,如此下去,直到送完最后一列代碼,又從頭開始送。
數(shù)字“1”代碼建立如下圖所示

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

其顯示代碼為 00H,00H,00H,00H,21H,7FH,01H,00H
數(shù)字“2”代碼建立如下圖所示
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00H,00H,27H,45H,45H,45H,39H,00H
數(shù)字“3”代碼建立如下圖所示

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00H,00H,22H,49H,49H,49H,36H,00H
數(shù)字“4”代碼建立如下圖所示
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00H,00H,0CH,14H,24H,7FH,04H,00H
數(shù)字“5”代碼建立如下圖所示
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00H,00H,72H,51H,51H,51H,4EH,00H
數(shù)字“6”代碼建立如下圖所示

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00H,00H,3EH,49H,49H,49H,26H,00H
數(shù)字“7”代碼建立如下圖所示
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00H,00H,40H,40H,40H,4FH,70H,00H
數(shù)字“8”代碼建立如下圖所示
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00H,00H,36H,49H,49H,49H,36H,00H
數(shù)字“9”代碼建立如下圖所示

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00H,00H,32H,49H,49H,49H,3EH,00H
5.匯編源程序
TIM           EQU 30H
CNTA        EQU 31H
CNTB        EQU 32H
                   ORG 00H
                   LJMP START
                   ORG 0BH
                   LJMP T0X
                   ORG 30H
START:      MOV TIM,#00H
                   MOV CNTA,#00H
                   MOV CNTB,#00H
                   MOV TMOD,#01H
                   MOV TH0,#(65536-4000)/256
                   MOV TL0,#(65536-4000) MOD 256
                   SETB TR0
                   SETB ET0
                   SETB EA
                   SJMP $
T0X:
                   MOV TH0,#(65536-4000)/256
                   MOV TL0,#(65536-4000) MOD 256
                   MOV DPTR,#TAB
                   MOV A,CNTA
                   MOVC A,@A+DPTR
                   MOV P3,A
                   MOV DPTR,#DIGIT
                   MOV A,CNTB
                   MOV B,#8
                   MUL AB
                   ADD A,CNTA
                   MOVC A,@A+DPTR
            MOV P1,A
                   INC CNTA
                   MOV A,CNTA
                   CJNE A,#8,NEXT
                   MOV CNTA,#00H
NEXT:       INC TIM
                   MOV A,TIM
                   CJNE A,#250,NEX
                   MOV TIM,#00H
                   INC CNTB
                   MOV A,CNTB
                   CJNE A,#10,NEX
                   MOV CNTB,#00H
NEX:         RETI
TAB:                   DB 0FEH,0FDH,0FBH,0F7H,0EFH,0DFH,0BFH,07FH
DIGIT:          DB 00H,00H,3EH,41H,41H,41H,3EH,00H
                   DB 00H,00H,00H,00H,21H,7FH,01H,00H
                   DB 00H,00H,27H,45H,45H,45H,39H,00H
                   DB 00H,00H,22H,49H,49H,49H,36H,00H
                   DB 00H,00H,0CH,14H,24H,7FH,04H,00H
                   DB 00H,00H,72H,51H,51H,51H,4EH,00H
                   DB 00H,00H,3EH,49H,49H,49H,26H,00H
                   DB 00H,00H,40H,40H,40H,4FH,70H,00H
                   DB 00H,00H,36H,49H,49H,49H,36H,00H
                   DB 00H,00H,32H,49H,49H,49H,3EH,00H
                   END
6.C語言源程序
#include
unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code digittab[10][8]={         {0x00,0x00,0x3e,0x41,0x41,0x41,0x3e,0x00},     //0
                                    {0x00,0x00,0x00,0x00,0x21,0x7f,0x01,0x00},     //1
                                    {0x00,0x00,0x27,0x45,0x45,0x45,0x39,0x00},    //2
                                    {0x00,0x00,0x22,0x49,0x49,0x49,0x36,0x00},    //3
                                    {0x00,0x00,0x0c,0x14,0x24,0x7f,0x04,0x00},     //4
                                    {0x00,0x00,0x72,0x51,0x51,0x51,0x4e,0x00},    //5
                                    {0x00,0x00,0x3e,0x49,0x49,0x49,0x26,0x00},    //6
                                    {0x00,0x00,0x40,0x40,0x40,0x4f,0x70,0x00},     //7
                                    {0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00},    //8
                                    {0x00,0x00,0x32,0x49,0x49,0x49,0x3e,0x00}     //9
                                    };
unsigned int timecount;
unsigned char cnta;
unsigned char cntb;
void main(void)
{
  TMOD=0x01;
  TH0=(65536-3000)/256;
  TL0=(65536-3000)%6;
  TR0=1;
  ET0=1;
  EA=1;
  while(1)
    {;
    }
}
void t0(void) interrupt 1 using 0
{
  TH0=(65536-3000)/256;
  TL0=(65536-3000)%6;
  P3=tab[cnta];
  P1=digittab[cntb][cnta];
  cnta++;
  if(cnta==8)
    {
      cnta=0;
    }
  timecount++;
  if(timecount==333)
    {
      timecount=0;
      cntb++;
      if(cntb==10)
        {
          cntb=0;
        }
    }
}

Tags:單片機(jī)點(diǎn)陣,LED顯示,數(shù)字顯示,單片機(jī)  
責(zé)任編輯:admin
相關(guān)文章列表
沒有相關(guān)文章
請(qǐng)文明參與討論,禁止漫罵攻擊,不要惡意評(píng)論、違禁詞語。 昵稱:
1分 2分 3分 4分 5分

還可以輸入 200 個(gè)字
[ 查看全部 ] 網(wǎng)友評(píng)論
最新推薦
關(guān)于我們 - 聯(lián)系我們 - 廣告服務(wù) - 友情鏈接 - 網(wǎng)站地圖 - 版權(quán)聲明 - 在線幫助 - 文章列表
返回頂部
刷新頁面
下到頁底
晶體管查詢