51 single chip microcomputer 8*8 dot matrix LED display principle and program

Publisher:数字梦想Latest update time:2012-04-22 Source: OFweek Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  • Display a column on the 8X8 dot matrix LED , and let it move smoothly from left to right three times, then move smoothly from right to left three times, then move smoothly from top to bottom three times, and finally move smoothly from bottom to top three times, and so on. 1. Program design content 8X8 dot matrix LED working principle description: 8X8 dot matrix requires a total of 64 light-emitting diodes, and each light-emitting diode is placed at the intersection of row and column lines. When the corresponding column is set to 1 level and the corresponding row is set to 0 level, the corresponding diode will light up; therefore, to realize the lighting method of a column, as shown in Figure 49, the corresponding column is a vertical column, or the corresponding row is a horizontal column. Therefore, the method of realizing the lighting of the column is as follows: A vertical column: the corresponding column is set to 1, and the row is realized by scanning. A horizontal column: the corresponding row is set to 0, and the column is realized by scanning. 2. Hardware circuit










    3. Assembly source program
    ORG 00H
    START: NOP
    MOV R3,#3
    LOP2: MOV R4,#8
    MOV R2,#0
    LOP1: MOV P1,#0 FF H
    MOV DPTR,#TABA
    MOV A,R2
    MOVC A,@A+DPTR
    MOV P3,A
    INC R2
    LCALL DELAY
    DJNZ R4,LOP1
    DJNZ R3,LOP2

    MOV R3,#3
    LOP4: MOV R4,#8
    MOV R2,#7
    LOP3: MOV P1,#0FFH
    MOV DPTR,#TABA
    MOV A,R2
    MOVC A,@A+DPTR
    MOV P3,A
    DEC R2
    LCALL DELAY
    DJNZ R4 ,LOP3
    DJNZ R3,LOP4

    MOV R3,#3
    LOP6: MOV R4,#8
    MOV R2,#0
    LOP5: MOV P3,#00H
    MOV DPTR,#TABB
    MOV A,R2
    MOVC A,@A+DPTR
    MOV P1,A
    INC R2
    LCALL DELAY
    DJNZ R4 ,LOP5
    DJNZ R3,LOP6

    MOV R3,#3
    LOP8: MOV R4,#8
    MOV R2,#7
    LOP7: MOV P3,#00H
    MOV DPTR,#TABB
    MOV A,R2
    MOVC A,@A+DPTR
    MOV P1,A
    DEC R2
    LCALL DELAY
    DJNZ R4 ,LOP7
    DJNZ R3,LOP8
    LJMP START

    DELAY: MOV R5,#10
    D2: MOV R6,#20
    D1: MOV R7,#248
    DJNZ R7,$
    DJNZ R6,D1
    DJNZ R5,D2
    RET

    TABA: DB 0FEH,0FDH,0FBH,0F7H,0EFH,0DFH,0BFH,07FH
    TABB: DB 01H,02H,04H,08H,10H,20H,40H,80H
    END

    4. C51 language source program
    #include

    unsigned char code taba[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
    unsigned char code tabb[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};

    void delay(void)
    {
    unsigned char i,j;
    for(i=10;i>0;i--)
    for(j=248;j>0;j--);
    }

    void delay1(void)
    {
    unsigned char i,j,k;
    for(k=10;k>0;k--)
    for(i=20;i>0;i--)
    for(j=248;j> 0;j--);
    }

    void main(void)
    {
    unsigned char i,j;
    while(1)
    {
    for(j=0;j<3;j++) //from left to right 3 time
    {
    for(i=0;i<8;i++)
    {
    P3=taba[i];
    P1=0xff;
    delay1();
    }
    }
    for(j=0;j<3;j++) //from right to left 3 time
    {
    for(i=0;i<8;i++ )
    {
    P3=taba[7-i];
    P1=0xff;
    delay1();
    }
    }
    for(j=0;j<3;j++) //from top to bottom 3 time
    {
    for(i=0;i< 8;i++)
    {
    P3=0x00;
    P1=tabb[7-i];
    delay1();
    }
    }
    for(j=0;j<3;j++) //from bottom to top 3 time
    {
    for(i=0 ;i<8;i++)
    {
    P3=0x00;
    P1=tabb[i];
    delay1();
    }
    }
    }
    }

  • Reference address:51 single chip microcomputer 8*8 dot matrix LED display principle and program

    Previous article:What issues should be considered in the design and installation of outdoor LED large screens?
    Next article:Advantages and problems of LED color wall screen application

    Latest Power Management Articles
    Change More Related Popular Components

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    About Us Customer Service Contact Information Datasheet Sitemap LatestNews


    Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

    Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号