Microcontroller learning record - digital tube

Publisher:幸福家庭Latest update time:2019-05-10 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Static digital tube

Hardware Hookup 

 Write the picture description here 

The figure shows a common anode digital tube. The 8 segments of the digital tube are 8 LEDs. The anodes of the LEDs are connected together and connected to a high level. When the cathode of a segment is connected to a low level, the segment will light up.


software design 

Put the segment codes from 0 to F into the array and display 0 to F in sequence.


unsigned char DIG_CODE[16]={0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07,0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71};


/****************************************************** ******************

* Function name: static_dig

* Function: Static digital tube displays in sequence

* Input: None

* Output: None

*************************************************** *************/

void static_dig(void)

{

    unsigned char i = 0;


    for (i=0; i<16; i++)

    {

        DIG = ~DIG_CODE[i];

        delay1s();

    }



}



Dynamic digital tube

Hardware Hookup 

Write the picture description here

The bit selection segment of the digital tube is connected to the output of the 38 decoder. The segment selection terminal is connected to the output of the 74573 follower. 

At a certain moment, only one digital tube can be lit. The intervals between the lighting of each digital tube can be shortened to take advantage of the afterglow effect of the human eye. It looks like all digital tubes are lit at the same time, showing different code values.


software design


unsigned char DIG_CODE[16]={0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07,0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71};

/****************************************************** **********

* Function name: dongtai_all

* Function: Each digital tube displays different contents in turn

* Input: None

* Output: None

*************************************************** **********/

void dongtai_all(void)

{

    unsigned char i = 0;


    for (i=0; i<8; i++)

    {

        WEI = i; //Bit selection, decide which digital tube is lit

        DUAN = DIG_CODE[i+1]; //Segment selection, determines which segment of the digital tube lights up (which number lights up)

        delay1s();

    }

}



Keywords:MCU Reference address:Microcontroller learning record - digital tube

Previous article:Microcontroller learning record - LED dot matrix
Next article:Microcontroller learning record - relay

Recommended ReadingLatest update time:2024-11-16 19:58

ARM and 51 MCU communication
The hardware is a mini2440 core board and another MCU learning board with a serial port (with DS18B20). The learning board continuously outputs the temperature value of DS18B20 with a baud rate of 19200. Create a new file in a folder, mine is voltage_set.c (to be used for voltage adjustment later)   #include stdio
[Microcontroller]
Basic knowledge of C language programming for microcontrollers (note for beginners)
C language programming on 80C51 Features of C51: (1) After students who have learned C language have a basic understanding of single-chip microcomputers, they can start to try to write one or two C language programs based on single-chip microcomputers. C51 language inherits most of the characteristics of ANSI C, and
[Microcontroller]
Fill in the blanks of the relevant storage units after executing the following microcontroller instructions
Assume that the internal RAM (30H) = 5AH, (5AH) = 40H, (40H) = 00H, and port P1 = 7FH. After executing the following instructions , what will be the contents of the relevant storage units (i.e., R0, R1, A, B, P1, 30H, 40H, and 5AH units)?     MOV    R0,#30H              ;R0=30H    MOV    A,@R0               ;A=5AH 
[Microcontroller]
How to use AVR microcontroller to write TEA5767 data
#include #include #define uchar unsigned char #define uint unsigned int #define long unsigned long void delay() { uint i=0; for (i=0;i《2000;i++) ; } unsigned char radio_write_data[5]={0x69,0x28,0xa0,0x13,0x00}; //Data to be written into TEA5767 void inputbyte(uchar CD) //Write one byte of data { fly i,mid=0; for (i=0;
[Microcontroller]
How to use AVR microcontroller to write TEA5767 data
Classic explanation of single chip music performance program
About the single chip microcomputer music performance of "Only Mother is Good in the World" When a single-chip microcomputer plays a note, it periodically outputs a square wave of a specific frequency through the pin. This requires the single-chip microcomputer to output a low level in half a cycle and a high leve
[Microcontroller]
MCU Basics (V): Working Principle and Mode of Timer/Counter
Timer/Counter The module in the microcontroller can be programmed to count the system clock (as a timer) or count external signals (as a counter) Each timer/counter has multiple working modes. Different working modes correspond to different counting lengths and initial value loading methods. There are two 16-bit progr
[Microcontroller]
MCU Basics (V): Working Principle and Mode of Timer/Counter
A Method of Real-time Data Monitoring Using VB6.0 Digital Oscilloscope Single Chip Microcomputer
1. Introduction The graphic display of the real-time monitoring data of the single-chip microcomputer is generally done with the help of a host PC with powerful data processing capabilities. VB6.0 has powerful graphics processing functions and good interface design functions, and can use the MsComm control to e
[Microcontroller]
A Method of Real-time Data Monitoring Using VB6.0 Digital Oscilloscope Single Chip Microcomputer
Design of electronic control system of smart IC card gas meter based on PIC microcontroller
Smart IC card gas meter is a civil high-tech product that can automatically measure and charge gas according to the gas purchase volume of the user's IC card, and automatically control gas consumption. It has incomparable advantages over traditional manual meter reading and charging gas meters. At present, with the
[Microcontroller]
Design of electronic control system of smart IC card gas meter based on PIC microcontroller
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号