Microcontroller Learning 8: Using Digital Tubes to Display Numbers

Publisher:真实幻想Latest update time:2016-09-09 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. Experimental Phenomenon

   Let the rightmost digital tube display the number 2 and the decimal point.

 

2. Experimental Purpose:
   To master the value assignment method of each I/O port when the digital tube displays the required number

 

3. Experimental task analysis
    In the previous experiments, we chose light-emitting diodes as display units. In this experiment, we will use digital tubes as display units. At this time, we should put the JMP0 jumper in the 2 and 3 positions to select digital tube display.
    Now let's take a look at the connection form of the circuit, as shown in the figure below. Microcontroller Learning 8: Use digital tube to display numbers - North Star - To be a good seed
      From the circuit diagram, we can see that the output of port p0 is the segment code of the digital tube, which controls the number displayed by the digital tube, and the output of port p2 is the bit code, which controls which digital tube is selected for display.
       So if the digital tube is to display 2, what should the output of port p0 and port p2 be? Now let's analyze the light-emitting principle of the digital tube.
        The digital tube is actually composed of several strip-shaped light-emitting diodes. There are two ways of connection, namely common cathode and common anode connection. As shown in the figure below:
                                        Microcontroller Learning 8: Use digital tube to display numbers - North Star - To be a good seed
    From the figure, we can see that for the digital tube connected with the common anode, in order to make it display normally, the com port should be connected to the power supply, and the corresponding field is to output a low-level drive. For the digital tube connected with the common cathode, com should be grounded, and the corresponding field outputs a high-level drive.
     Since the learning board uses a common anode digital tube, if you want the rightmost S0 to display a number, P2.0 should output a high level, so that the com terminal of S0 is connected to a high level and S0 is selected for display; if it is to display 2 and the decimal point is also displayed, the a, b, g, e, d, dp fields output a low level, and the remaining fields output a high level.
      At the same time, since the corresponding relationship between the P0 port and each field is: P0.7 P0.6 P0.5 P0.4 P0.3 P0.2 P0.1 P0.0~d dp ecgbfa, we should assign 12h to the P0 port, and then let P2.0 output a high level. 
4. The experimental procedure is as follows:
org 0000h;
start: clr p1.5
      mov a,#012h; when displaying the number 2 and the decimal point, the corresponding 8-segment code
      mov p0,a; send the 8-segment code to port P0
      mov P2,#01H; select the rightmost digital tube to display
      ljmp start
      end

 

5. For easy reference, the contents of various digital displays corresponding to the P0 port are shown in the following table:
 Microcontroller Learning 8: Use digital tube to display numbers - North Star - To be a good seed                             

Reference address:Microcontroller Learning 8: Using Digital Tubes to Display Numbers

Previous article:MCU Learning VII: Basic I/O Port Experiment 3 - Left and Right Marquee
Next article:MCU Learning 5: Basic I/O Port Experiment - Lighting up the Diode

Latest Microcontroller 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号