51 MCU Series Serial 3 - Digital Tube Static Display

Publisher:BlissfulBlissLatest update time:2015-09-10 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Today I will mainly introduce digital tubes. In fact, after learning about light-emitting diodes, digital tubes are not difficult to understand, because the two are originally connected. First, let's take a look at the actual picture, which is basically familiar to everyone:

 

                                 51 MCU Series Serial 3 - Digital Tube Static Display

      Its internal structure is composed of 8 light-emitting diodes, but it is necessary to distinguish between common anode and common cathode, which is the same as the previous diode principle. Of course, pay attention to the order when arranging, usually from a to h.

 

                                    51 MCU Series Serial 3 - Digital Tube Static Display


       So what are dynamic display and static display? Let's take a look at the official answer. The so-called static display means that each segment code of the digital tube must occupy an output port with a latching function. The CPU sends the character code to be displayed to the output port, and the digital tube can display the corresponding character. Until the next time another character code is sent, the displayed content will not disappear; dynamic scanning is to connect the same segments of A-dp in the 8 segment codes of all displays together and connect them to a common output port, and the bit ends of the digital tube are connected to other output ports respectively, and the display effect is produced through the interaction of the two groups of signals from the two output ports. That is, let each digital tube display in turn in a certain order. As long as the scanning frequency is high enough, due to the "visual persistence" phenomenon of the human eye, it can be displayed continuously and stably.

      Next, write a few programs to make it light up:

1. One digital tube lights up

    #include

    sbit  duan=P2^2;

    sbit  wei=P2^3;

    void  main()

     {

      wei=1;

     P0=0x00;

     wei=0xbf; (The result of this statement is that the 7th digital tube lights up and displays 4)

     duan=1;

    P0=0x66;

    duan=1;

    while(1);

       }

2. Multiple digital tubes static display 

     #include

     #define  uint  unsigned  int

     #define  uchar  unsigned  char

     sbit  duan=P2^2;

     sbit  wei=P2^3;

     uchar  code  table[]=    {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};

    void  delay  (uint  z);

    void  main()

    {wei=1;

    P0=0xea;

    wei=0;

    while(1)

   {uint  num;

     for(num=0;num<16;num )

   {

   duan=1;

   P0=table[num];

   duan=0;

   delay(1000);

     }

     }

    }

 

   void  delay  (uint  z)

   {

    uint  x,y;

    for(x=z;x>0;x--)

     for(y=110;y>0;y--);

    }

 

   The above is a simple analysis of the static display of the digital tube. The dynamic one will be introduced later. In the digital tube, the main thing to solve is the bit latch and segment latch. Once you understand this, the rest is simple C language programming, which is actually not difficult!

Reference address:51 MCU Series Serial 3 - Digital Tube Static Display

Previous article:51 MCU Series Serial 4 - Interrupt
Next article:51 MCU Series Serial 2 - Beautiful LED

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号