The microcontroller lights up the digital tube

Publisher:bemaiiLatest update time:2017-01-11 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The schematic diagram of the digital tube is as above. The corresponding numbers or characters are spelled out by lighting up the seven LEDs. The digital tube has a common anode (low level light) and a common cathode (high level light). Take the number 2 in the above figure as an example:

Common anode (0 on, 1 off): DP G F E D C B A

                             1 0 1 0 0 1 0 0 = 0xA4

Common cathode (1 on, 0 off): DP G FE D C B A  

                             0 1 0 1 1 0 1 1 = 0x5B

Full definitions:

The attached Excel file contains all the codes for common anode and common cathode;

Taking the common anode as an example, define 0-9 in an array (called "table" in C language? Anyone who knows can enlighten me), and display 0-9 in sequence through a loop;

#include

unsigned char code dofly_table[10]={0xc0,0xf9,0xa4,0xb0,0x99,
0x92,0x82,0xf8,0x80,0x90,}; 
// Display value table 0-9
void Delay();

void main ()
{
  unsigned char i;
  while(1)
  {
     for (i = 0; i < 10; i++)
     {
        P1=dofly_table[i];
        Delay();
     }
  }
}

void Delay() // 12M crystal oscillator 1s delay
{
unsigned char h, i, j, k;

for (h = 5; h > 0; h--)
for (i = 4; i > 0; i--)
for (j = 116; j > 0; j--)
for (k = 214; k > 0; k--); // The last one must have a ;

}


Keywords:MCU Reference address:The microcontroller lights up the digital tube

Previous article:Digital tube displays dynamic numbers
Next article:The digital tube displays the number corresponding to the key

Recommended ReadingLatest update time:2024-11-16 21:44

Some re-addresses of 51 MCU ROM
Some re-addresses of 51 MCU ROM   0000H    MCU entry address after reset                            (3 bytes in total) 00003H  External interrupt 0 interrupt service entry address                  (  8 bytes in total) 000BH    Timer/Counter 0 overflow interrupt service entry address    (8 bytes in total) 0013H
[Microcontroller]
Communication between MCU and Serial Port 232 (Continued)
Purpose: After sending data through the serial port sending area, the serial port receiving area receives the sent data. //Note whether the serial port setting is hexadecimal or ASIIC code? If it is hexadecimal, the first data received is 00. If it is ASIIC, no data is displayed. program: #include reg52.h bit poin
[Microcontroller]
Temperature controlled fan based on 51 microcontroller
Design requirements: 1. This design is based on STC89C51/52 (common to AT89S51/52, AT89C51/52, optional) microcontroller • 2. Use DS18B20 temperature sensor to measure temperature (0-99.9°C), and the triode drives the digital tube to display the temperature and fan gear. • 3. A total of 3 buttons: set, add and subtrac
[Microcontroller]
Temperature controlled fan based on 51 microcontroller
Some suggestions for beginners of 8-bit microcontrollers
Pre-study requirements: (1) Have a certain foundation in C language, (2) preferably have some knowledge of digital circuits   Preface: (1) As long as you are a student of the Department of Electronics or Computer Science. C language is the minimum threshold for you to get professional knowledge. Therefore, students
[Microcontroller]
MCU Implementation of Satellite TV Receiver Control
STC001 is a high-performance, low-cost satellite TV receiver control chip. Different from the traditional ASIC implementation, it implements related functions in the form of 8-bit MCU with software. An obvious advantage over ASIC is that it can realize multiple functions of the chip by modifying the equipped softwar
[Microcontroller]
MCU Implementation of Satellite TV Receiver Control
Design of soft starter for three-phase asynchronous motor using single-chip microcomputer AT89C51
The three-phase asynchronous motor soft starter based on the single-chip microcomputer AT89C51 introduced here essentially improves the starting characteristics of the AC motor, and has functions such as power-saving operation, overcurrent protection, overload protection, and phase loss protection. 1
[Microcontroller]
Design of soft starter for three-phase asynchronous motor using single-chip microcomputer AT89C51
Summary of LCD1602 based on 51 single chip microcomputer to realize minute and second timing
Completion requirements 1. Realize the timing of minutes and seconds. 2. Use buttons to control the adjustment of minutes and seconds (two buttons control the increase of minutes and seconds respectively). 3. Realize the function of telling time in whole and minute (buzzer sounds). 4. Drawing and welding of PCB board
[Microcontroller]
Summary of LCD1602 based on 51 single chip microcomputer to realize minute and second timing
Design of equivalent sampling oscilloscope based on microcontroller
Abstract: This paper introduces the method of equivalent sampling of high-frequency signals (1MHz ~ 80MHz) based on the precision clock generation circuit of the microcontroller system, and designs and implements a simple digital oscilloscope with an analog bandwidth of 1Hz ~ 80MHz. Keywords: MCU equivalent sampling di
[Test Measurement]
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号