日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

Ardino基础教程 25_8X8LED点阵

發(fā)布時(shí)間:2025/4/5 80 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Ardino基础教程 25_8X8LED点阵 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

實(shí)驗(yàn)二十五:8X8LED點(diǎn)陣

點(diǎn)陣實(shí)驗(yàn)另一版本代碼參考如下鏈接下載:ArduinoCode25-8X8LED點(diǎn)陣num.ino
點(diǎn)陣在我們生活中很常見(jiàn),很多都有用到他,比如LED 廣告顯示屏,電梯顯示樓層。公交車(chē)報(bào)站,等等,,,數(shù)不勝數(shù)。廢話(huà)不多說(shuō),趕緊學(xué)習(xí)吧。

1、8X8LED點(diǎn)陣原理圖

2、8X8LED點(diǎn)陣實(shí)物圖

圖為8×8點(diǎn)陣LED外觀及引腳圖,其等效電路如圖所示,只要其對(duì)應(yīng)的X、Y軸順向偏壓,即可使LED發(fā)亮。例如如果想使左上角LED點(diǎn)亮,則Y0=1,X0=0即可。應(yīng)用時(shí)限流電阻可以放在X軸或Y軸

3、8X8LED點(diǎn)陣掃描方式
LED一般采用掃描式顯示,實(shí)際運(yùn)用分為三種方式

  • 點(diǎn)掃描
  • 行列掃描
  • 16×64=1024Hz,周期小于1ms即可。若使用第二和第三種方式,則頻率必須大于16×8=128Hz,周期小于7.8ms即可符合視覺(jué)暫留要求。此外一次驅(qū)動(dòng)一列或一行(8顆LED)時(shí)需外加驅(qū)動(dòng)電路提高電流,否則LED亮度會(huì)不足。

    4、8X8LED點(diǎn)陣應(yīng)用舉例
    點(diǎn)陣內(nèi)部結(jié)構(gòu)及外形如下,8X8點(diǎn)陣共由64個(gè)發(fā)光二極管組成,且每個(gè)發(fā)光二極管是放置在行線和列線的交叉點(diǎn)上,當(dāng)對(duì)應(yīng)的某一行置1電平,某一列置0電平,則相應(yīng)的二極管就亮;如要將第一個(gè)點(diǎn)點(diǎn)亮,則9腳接高電平13腳接低電平,則第一個(gè)點(diǎn)就亮了;如果要將第一行點(diǎn)亮,則第9腳要接高電平,而(13、3、4、10、6、11、15、16)這些引腳接低電平,那么第一行就會(huì)點(diǎn)亮;如要將第一列點(diǎn)亮,則第13腳接低電平,而(9、14、8、12、1、7、2、5)接高電平,那么第一列就會(huì)點(diǎn)亮。

    一般我們使用點(diǎn)陣顯示漢字是用的1616的點(diǎn)陣宋體字庫(kù),所謂1616,是每一個(gè)漢字在縱、橫各16點(diǎn)的區(qū)域內(nèi)顯示的。也就是說(shuō)得用四個(gè)88點(diǎn)陣組合成一個(gè)1616的點(diǎn)陣。如下圖所示,要顯示“你”則相應(yīng)的點(diǎn)就要點(diǎn)亮,由于我們的點(diǎn)陣在列線上是低電平有效,而在行線上是高電平有效,所以要顯示“你”字的話(huà),它的位代碼信息要取反,即所有列(13~16腳)送(1111011101111111,0xF7,0x7F),而第一行(9腳)送1信號(hào),然后第一行送0。再送第二行要顯示的數(shù)據(jù)(13~16腳)送(1111011101111111,0xF7,0x7F),而第二行(14腳)送1信號(hào)。依此類(lèi)推,只要每行數(shù)據(jù)顯示時(shí)間間隔夠短,利用人眼的視覺(jué)暫停作用,這樣送16次數(shù)據(jù)掃描完16行后就會(huì)看到一個(gè)“你”字;第二種送數(shù)據(jù)的方法是字模信號(hào)送到行線上再掃描列線也是同樣的道理。同樣以“你”字來(lái)說(shuō)明,16行(9、14、8、12、1、7、2、5)上送(0000000000000000,0x00,0x00)而第一列(13腳)送、“0”。同理掃描第二列。當(dāng)行線上送了16次數(shù)據(jù)而列線掃描了16次后一個(gè)“你”字也就顯示出來(lái)了。

    因此,形成的列代碼為 00H,00H,3EH,41H,41H,3EH,00H,00H;只要把這些代碼分別依次送到相應(yīng)的列線上面,即可實(shí)現(xiàn)“0”的數(shù)字顯示。

    點(diǎn)亮8X8點(diǎn)陣LED的一個(gè)LED如下:


    這個(gè)是顯示“0”的程序代碼。
    //定義了一個(gè)數(shù)組,用來(lái)存放“0”字的字模
    unsigned char Text[]={0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c};
    void Draw_point(unsigned char x,unsigned char y)//畫(huà)點(diǎn)函數(shù)
    {
    clear_();
    digitalWrite(x+2, HIGH);
    digitalWrite(y+10, LOW);
    delay(1);
    }
    void show_num(void)//顯示函數(shù),最終還是調(diào)用了畫(huà)點(diǎn)函數(shù)。
    {
    unsigned char i,j,data;
    for(i=0;i<8;i++)
    {
    data=Text[i];
    for(j=0;j<8;j++)
    {
    if(data & 0x01)Draw_point(j,i);
    data>>=1;
    }
    }
    }
    void setup(){
    int i = 0 ;
    for(i=2;i<18;i++)
    {
    pinMode(i, OUTPUT);
    }
    clear_();
    }
    void loop()
    {
    show_num();
    }
    void clear_(void)//清除屏幕
    {
    for(int i=2;i<10;i++)
    digitalWrite(i, LOW);
    for(int i=0;i<8;i++)
    digitalWrite(i+10, HIGH);
    }


    實(shí)驗(yàn)截圖



    Arduino 8x8點(diǎn)陣 //注意引腳圖是反起看的,當(dāng)原件插上去的時(shí)候,左右交換。

    連線對(duì)應(yīng)關(guān)系:
    要在其中一列加上1K或220歐姆限流電阻
    Arduino 8x8點(diǎn)陣
    2 ----------------------0 //行選0
    3 ----------------------1 //行選1
    4 ----------------------2 //行選2
    5 ----------------------3 //行選3
    6 ----------------------4 //行選4
    7 ----------------------5 //行選5
    8 ---------------------6 //行選6
    9 ---------------------7 //行選7
    Arduino 8x8點(diǎn)陣
    10 ---------------------A //列選A
    11 ---------------------B //列選B
    12 ---------------------C //列選C
    13 ---------------------D //列選D
    14 ---------------------E //列選E
    15 ---------------------F //列選F
    16 ---------------------G //列選G
    17 ---------------------H //列選H

    程序代碼

    //the pin to control ROW const int row1 = 2; // the number of the row pin 9 const int row2 = 3; // the number of the row pin 14 const int row3 = 4; // the number of the row pin 8 const int row4 = 5; // the number of the row pin 12 const int row5 = 6; // the number of the row pin 1 const int row6 = 7; // the number of the row pin 7 const int row7 = 8; // the number of the row pin 2 const int row8 = 9; // the number of the row pin 5 //the pin to control COl const int col1 = 10; // the number of the col pin 13 const int col2 = 11; // the number of the col pin 3 const int col3 = 12; // the number of the col pin 4 const int col4 = 13; // the number of the col pin 10 const int col5 = 14; // the number of the col pin 6 const int col6 = 15; // the number of the col pin 11 const int col7 = 16; // the number of the col pin 15 const int col8 = 17; // the number of the col pin 16 void setup(){ int i = 0 ; for(i=2;i<18;i++) { pinMode(i, OUTPUT); } pinMode(row5, OUTPUT); pinMode(row6, OUTPUT); pinMode(row7, OUTPUT); pinMode(row8, OUTPUT); for(i=2;i<18;i++) { digitalWrite(i, LOW); } for(i=2;i<18;i++) { digitalWrite(row5, LOW); } } void loop(){ int i; for(i=2;i<10;i++) {digitalWrite(i, HIGH);delay(200);clear_(); } //delay(1000); } void clear_(void) {for(int i=2;i<18;i++)digitalWrite(i, LOW); } //the pin to control ROW const int row1 = 2; // the number of the row pin 9 const int row2 = 3; // the number of the row pin 14 const int row3 = 4; // the number of the row pin 8 const int row4 = 5; // the number of the row pin 12 const int row5 = 6; // the number of the row pin 1 const int row6 = 7; // the number of the row pin 7 const int row7 = 8; // the number of the row pin 2 const int row8 = 9; // the number of the row pin 5 //the pin to control COl const int col1 = 10; // the number of the col pin 13 const int col2 = 11; // the number of the col pin 3 const int col3 = 12; // the number of the col pin 4 const int col4 = 13; // the number of the col pin 10 const int col5 = 14; // the number of the col pin 6 const int col6 = 15; // the number of the col pin 11 const int col7 = 16; // the number of the col pin 15 const int col8 = 17; // the number of the col pin 16 unsigned char Text[]={0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c}; void Draw_point(unsigned char x,unsigned char y) {clear_();digitalWrite(x+2, HIGH);digitalWrite(y+10, LOW);delay(1); } void show_num(void) {unsigned char i,j,data;for(i=0;i<8;i++){data=Text[i];for(j=0;j<8;j++){if(data & 0x01)Draw_point(j,i);data>>=1;} } } void setup(){ int i = 0 ; for(i=2;i<18;i++) { pinMode(i, OUTPUT); } clear_(); } void loop() { show_num(); } void clear_(void) {for(int i=2;i<10;i++)digitalWrite(i, LOW);for(int i=0;i<8;i++)digitalWrite(i+10, HIGH); }

    總結(jié)

    以上是生活随笔為你收集整理的Ardino基础教程 25_8X8LED点阵的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。