当前位置:网站首页>Realization of digital tube display based on C51
Realization of digital tube display based on C51
2022-07-29 02:12:00 【Miaowu】
Preface : This experiment is based on STC89C52RC Single chip microcomputer , Program and control the static and dynamic display of the nixie tube according to the circuit schematic . because 51 The structure of Series MCU is similar , Readers can draw inferences from this blog , Realize the required functions .
Catalog :
- One 、 Digital tube introduction
- Two 、 Circuit schematic analysis
- 3、 ... and 、 Realize the static display of nixie tube
- Four 、 Realize the dynamic display of nixie tube
The single chip microcomputer selected in the experiment and its structure are displayed ( In general C51 For example , The others are similar ), The buzzer operated in this experiment is located in the serial number ① Location
One 、 Digital tube introduction
Nixie tube is a kind of semiconductor light-emitting device , Its basic unit is light-emitting diode . The development board used in this experiment contains eight digital tubes , Different numbers can be achieved by lighting different nixie tube sequences / Letter display effect . As shown in the figure below , Lighten up {A,B,C,D,E,F} Segment nixie tube , You can display numbers 0
The effect of
The nixie tube can be divided into Common anode digital tube
and Common cathode digital tube
️ Gongyang nixie tube
It refers to connecting the anodes of all light-emitting diodes together to form a common anode (COM) My digital tube . In the application of Gongyang nixie tube, the common pole should be used COM Receive +5V, When the cathode of a field is low , The corresponding field lights up , When the cathode of a field is high , The corresponding field is not on
️ Common cathode digital tube
It refers to connecting the cathodes of all light-emitting diodes together to form a common cathode (COM) My digital tube . In the application of common cathode nixie tube, the common pole should be used COM Connect to the ground wire GND On , When the anode of a field led is at high level , The corresponding field lights up , When the anode of a field is low , The corresponding field is not on
️ example : To achieve the digital display in a digital tube 0
, If the development board is loaded with common anode nixie tubes , As shown in the figure above , It's in { decimal point 、G} Input high level , Low level input of other pins can be achieved ; If the development board is loaded with a common cathode digital tube , On the contrary . The development board used in this experiment is a common cathode 8 Digital tube , The physical drawing of digital tubes with different digits is shown in the figure below :
LED There are two ways for nixie tube display : Static display mode
and Dynamic display mode
. The characteristic of static display is that the segment selection of each nixie tube must be followed by one 8 Bit data line to keep the font code displayed . The feature of dynamic display is to connect all segments of nixie tubes in parallel , The line selection by bit controls which digital tube . In terms of implementation effect , Static display mode is to display one digit / Letter , The display effect of dynamic display mode is multi digit / Letter . The principle of dynamic display mode is Fast selection of multi digit nixie tubes , Static display of each nixie tube , Using the afterglow of the light-emitting tube and the persistence of human vision
.
Two 、 Principle and circuit diagram analysis
2.1 Segment selection of nixie tube
This experiment is on board Each of the eight sections has a total cathode
Nixie tube , Different numbers can be achieved by lighting the nixie tubes of different specified sequences / Alphabetic display . Here are the... Of the common cathode nixie tube 0-F Segment code data table . As shown in the figure below :
Explain with examples : Why display numbers 0 The segment selection sequence of is 0x3f
0 : 0x3f
0x3f Binary representation as 00111111 , Corresponding to each of the nixie tubes 8 paragraph ,“. G F E D C B A”, Expressed by output level , Decimal point segment and G Segment output low level , The output of common cathode digital tube is 0. Other display sequences are analogized .
2.2 Bit selection of nixie tube
This experiment board contains eight digit digital tubes , The single chip microcomputer needs to output a bit selection signal to select which digital tube to display , If each nixie tube is controlled by a single-chip microcomputer pin , And each eight segment needs to be controlled by eight pins of the single chip microcomputer , You need to occupy the MCU 16 Pins are used to control the whole nixie tube system . therefore , For the bit selection of digital tube system , In order to reduce the occupation of MCU pins , There's another one out there 74HC138
The decoder uses three pins to complete the selection of eight digit nixie tubes .38 The decoder is shown in the figure below :
The principle of 38 decoder is : Three bits of binary can represent exactly eight numbers . This experimental board uses P2.2
、P2.3
、P2.4
Three pins for bit selection of the eight digit nixie tube system . Such as the input "111" Select the eighth digit nixie tube
2.3 Circuit diagram analysis
74HC245 Introduction of chip function
In the circuit diagram above , In the MCU pin and nixie tube system, a piece of 74HC245 chip . This is because the non-public anode of the common cathode nixie tube is connected to IC Chip I/O On , and IC The driving ability of chips is often relatively small .74HC245 The chip can increase the driving ability for the output signal of the single chip microcomputer
Display principle
According to the above circuit diagram, it can be analyzed : Use single chip microcomputer `P22`、`P23`、`P24` The pin selects the position of the nixie tube system , Use single chip microcomputer `P0` The pin of the port carries out segment selection for the nixie tube corresponding to the selection bit .3、 ... and 、 Realize the static display of nixie tube
This experiment uses SMG1 The digital tube on the far left is used as a static digital tube , Because of MCU IO External pull-up resistance is added outside the port , therefore P22、P23、P24 Pin , The default is high , according to 38 Output characteristics of decoder , here Y7 Pin (LED8) The output is valid . The control code is as follows :
/**************************************************************************************
Name of the experiment : Static nixie tube experiment
Experimental phenomena : After downloading the program “ Nixie tube module ” The leftmost nixie tube displays numbers 0
***************************************************************************************/
#include "reg52.h"
typedef unsigned int u16; // Redefine the system default data
typedef unsigned char u8;
#define SMG_A_DP_PORT P0 // Use the macro to define the code port of the nixie tube segment
// Common cathode nixie tube display 0-F Segment code data
u8 gsmg_code[17]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void main()
{
SMG_A_DP_PORT=gsmg_code[0];// Assign the first data of the array to the selection port of the nixie tube
while(1)
{
}
}
Experimental phenomena
Four 、 Realize the dynamic display of nixie tube
The essence of nixie tube dynamic display is multi bit static fast display , Use visual residue to realize dynamic display . It needs segment selection and bit selection to work at the same time . The implementation code is as follows :
/**************************************************************************************
Name of the experiment : Dynamic nixie tube experiment
Experimental phenomena : After downloading the program “ Nixie tube module ” Show 01234567
***************************************************************************************/
#include "reg52.h"
typedef unsigned int u16; // Redefine the default data type of the system
typedef unsigned char u8;
#define SMG_A_DP_PORT P0 // Use the macro to define the code port of the nixie tube segment
// Define nixie tube position selection signal control pin
sbit LSA=P2^2;
sbit LSB=P2^3;
sbit LSC=P2^4;
// Common cathode nixie tube display 0-F Broken code data
u8 gsmg_code[17]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
/*******************************************************************************
* Function name : delay_10us
* The functionality : The time delay function ,ten_us = 1 when , About time delay 10us
* Input : ten_us
*******************************************************************************/
void delay_10us(u16 ten_us)
{
while(ten_us--);
}
/*******************************************************************************
* Function name : smg_display
* The functionality : Dynamic nixie tube display
*******************************************************************************/
void smg_display(void)
{
u8 i=0;
for(i=0;i<8;i++)
{
switch(i)// Biting
{
case 0: LSC=1;LSB=1;LSA=1;break;
case 1: LSC=1;LSB=1;LSA=0;break;
case 2: LSC=1;LSB=0;LSA=1;break;
case 3: LSC=1;LSB=0;LSA=0;break;
case 4: LSC=0;LSB=1;LSA=1;break;
case 5: LSC=0;LSB=1;LSA=0;break;
case 6: LSC=0;LSB=0;LSA=1;break;
case 7: LSC=0;LSB=0;LSA=0;break;
}
SMG_A_DP_PORT=gsmg_code[i];// Transmit segment selected data
delay_10us(100);// Delay for a period of time , Wait for the display to stabilize
SMG_A_DP_PORT=0x00;// Silencing
}
}
void main()
{
while(1)
{
smg_display();
}
}
Experimental results
Thank you for watching. , If you have doubts or supplements about the content , Feel free to leave a comment , Common progress !!!
边栏推荐
- Implementation of 10m multifunctional signal generator with FPGA
- Talk about possible problems when using transactions (@transactional)
- 点击按钮,下滑到指定的位置
- Stonedb invites you to participate in the open source community monthly meeting!
- Have you ever encountered the situation that the IP is blocked when crawling web pages?
- “蔚来杯“2022牛客暑期多校训练营2,签到题GJK
- 数学建模——派出所选址
- Comprehensive explanation of "search engine crawl"
- 为什么 BI 软件都搞不定关联分析
- 试着换个角度理解低代码平台设计的本质
猜你喜欢
In 2022, the official data of programming language ranking came, which was an eye opener
弹性布局 单选
Have you ever encountered the situation that the IP is blocked when crawling web pages?
autoware中ndtmatching功能加载点云图坐标系修正的问题
[electronic components] constant voltage, amplify the current of the load (triode knowledge summary)
[circuit design] convert AC AC to DC
基于C51控制蜂鸣器
Verilog procedure assignment statements: blocking & non blocking
(CVPR-2019)选择性的内核网络
Mysql存储json格式数据
随机推荐
Mathematical modeling -- Optimization of picking in warehouse
Have you ever encountered the situation that the IP is blocked when crawling web pages?
leetcode/和大于等于target的连续最短子数组
Why can't Bi software do correlation analysis
数学建模——带相变材料的低温防护服御寒仿真模拟
The solution of reducing the sharpness of pictures after inserting into word documents
Qt源码分析--QObject(4)
H5 background music is played automatically by touch
[the road of Exile - Chapter 6]
Navigation--实现Fragment之间数据传递和数据共享
基于C51实现数码管的显示
[UE4] replay game playback for ue4.26
忽略微信设置字体
Control the pop-up window and no pop-up window of the input box
QT memory management tips
Click back to the top JS
给LaTeX公式添加优美的注解;日更『数据科学』面试题集锦;大学生『计算机』自学指南;个人防火墙;前沿资料/论文 | ShowMeAI资讯日报
Lxml web page capture the most complete strategy
Mathematical modeling -- cold proof simulation of low temperature protective clothing with phase change materials
[circuit design] convert AC AC to DC