当前位置:网站首页>Actual combat 8051 drives 8-bit nixie tube
Actual combat 8051 drives 8-bit nixie tube
2022-07-03 04:54:00 【Huawei MCU programming】
8051 Drive common cathode
There is a little time for Chinese New Year , Clean up the computer , Turn to a previous small work , At the request of a new friend , control 8 Digital tube , Show... In turn 0~9. Send it out for everyone to see , Master, please skip .

Because there was no development board in hand , Just use Proteus Let's do circuit simulation .
The work environment :
Keil uVision5
Proteus 8 Professional
Nixie tube

First of all, understand the relevant knowledge of digital tubes
The basic unit of digital tube is led , According to the number of segments, it can be divided into seven segment nixie tubes and eight segment nixie tubes , Eight segment nixie tube has one more LED unit than seven segment nixie tube , One more decimal point (DP), This decimal point can more accurately represent what the nixie tube wants to display ; Press to display how many (8) Can be divided into 1 position 、2 position 、3 position 、4 position 、5 position 、6 position 、7 position 、8 Digital tube .
> Internal principle of digital tube

The above figure is an internal schematic diagram of a nixie tube , The display part of a nixie tube consists of 8 Diodes , Just one byte ,51 SCM is also 8 Bit MCU .
According to the common connection end of the internal led , It can be divided into common anode connection and common cathode connection , The common anode connection method is that the positive poles of light-emitting diodes are connected to the power supply together VCC, The number is displayed by controlling whether the negative pole of each LED is grounded . Common cathode connection means that the negative pole of each LED is grounded together GND, The number is displayed by controlling whether the positive pole of each LED is connected to the power supply .
In the figure a~g The pin controls the on and off of each LED respectively , therefore , If you want to show 1 Words , Just light up b,c Two paragraphs ( Output the corresponding port of MCU 0x06 that will do ); If you want to display numbers 5, Then just light up a,f,g,c,d Segments can form numbers 5 Display of (0x6d).
> Internal schematic diagram of multi digit nixie tube


Above, 4 Internal wiring of bit nixie tube , Anode of each nixie tube ( Or cathode ) Connected to a , Other pins of the same pin are connected , Altogether 12 Two control pins , It can also be concluded that 8 Digit digital tubes have 16 Two control pins ,8 Ge Gongyang ( Or common Yin ) End ,8 A control a~g According to the content .
74LS138 Decoder
From the display principle of digital tube , A nixie tube should display different characters , It is necessary to control each diode in the nixie tube differently , Each diode needs to use a control pin of the MCU , For example, in practical applications, eight digit common cathode or common anode digital tubes , share 16 One pin , If you use MCU pins to control , This is too wasteful , Originally, the resources of SCM are very tight .
The solution is to use a decoder as the bit selector of the nixie tube , Which display is needed to control the common Yang of which nixie tube ( Or common Yin ) End .

74LS138 Decoder 1~3 Is the input , From high to low CBA; 7~15 Is the output , From high to low Y7-Y0.
working process : Input three binary numbers at the input end , To decimal , After passing through the decoder , The output end corresponds to the pin of decimal number ( Corresponding Y) Low level , The rest are high level , such as :
Input 000, Decimal system 0, The output of 0 Bit pin is low , Others are high , That is to say 1111 1110;
Input 101, Decimal system 5, The output of 5 Bit pin is low , Others are high , That is to say 1101 1111.
Three binary numbers can just represent 0~7,8 A digital , That is, you can control 8 Digital tube .
P=============roteus Circuit diagram

Programming
#include <REGX51.H>
// The time delay function
void delay(unsigned int ms){
int k,l;
for(k=0;k<ms;k++)
for(l=0;l<120;l++);
}
// A nixie tube display 0~f Hexadecimal array
char numHex[] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
/**
Choose the digital tube , And display the corresponding decimal number
index : Nixie tube position subscript
num :char numHex[] The array corresponds to the subscript of the decimal number
*/
void setIndexNum(unsigned char index,unsigned char num){
switch(index){// Digital tube position selection ,74LS138 The input of the decoder
case 0:
P1_2=0;
P1_3=0;
P1_4=0;
break;
case 1:
P1_2=1;
P1_3=0;
P1_4=0;
break;
case 2:
P1_2=0;
P1_3=1;
P1_4=0;
break;
case 3:
P1_2=1;
P1_3=1;
P1_4=0;
break;
case 4:
P1_2=0;
P1_3=0;
P1_4=1;
break;
case 5:
P1_2=1;
P1_3=0;
P1_4=1;
break;
case 6:
P1_2=0;
P1_3=1;
P1_4=1;
break;
case 7:
P1_2=1;
P1_3=1;
P1_4=1;
break;
}
P3=numHex[num];// The nixie tube displays characters
}
void main(){
//proteus no need while Can be recycled , Don't understand
unsigned char i,j;
for(i = 0;i < 8;i++){
for(j = 0;j < 16;j++){
setIndexNum(i,j);
delay(300);
if(j >= 15) break;
}
if(i >= 7) break;
}
}
Friends who want to learn SCM together , Comment on ” I want to get started “, Have a pleasant surprise , Join us , You can interact with your mentor one-on-one , The rapid growth

边栏推荐
- 移动端——uniapp开发记录(公共请求request封装)
- MySQL winter vacation self-study 2022 12 (3)
- 逆袭大学生的职业规划
- stm32逆向入门
- Review the configuration of vscode to develop golang
- 文献阅读_基于多模态数据语义融合的旅游在线评论有用性识别研究(中文文献)
- The process of browser accessing the website
- Oracle SQL table data loss
- Summary of training competition (Lao Li's collection of questions)
- [luatos sensor] 2 air pressure bmp180
猜你喜欢

Learning practice: comprehensive application of cycle and branch structure (I)

带有注意力RPN和多关系检测器的小样本目标检测网络(提供源码和数据及下载)...

关于开学的准备与专业认知

String matching: find a substring in a string

Leetcode simple question: check whether the array is sorted and rotated

Leetcode simple problem delete an element to strictly increment the array

Thesis reading_ ICD code_ MSMN

论文阅读_清华ERNIE

Oracle SQL table data loss

ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation
随机推荐
[luatos sensor] 2 air pressure bmp180
Market status and development prospect prediction of global fermentation acid industry in 2022
General undergraduate college life pit avoidance Guide
The 19th Zhejiang I. barbecue
data2vec! New milestone of unified mode
雇佣收银员(差分约束)
Silent authorization login and registration of wechat applet
Compile and decompile GCC common instructions
ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation
Learning practice: comprehensive application of cycle and branch structure (I)
Sdl2 + OpenGL glsl practice (Continued)
文献阅读_基于多模态数据语义融合的旅游在线评论有用性识别研究(中文文献)
The least operation of leetcode simple problem makes the array increment
First + only! Alibaba cloud's real-time computing version of Flink passed the stability test of big data products of the Institute of ICT
Market status and development prospect prediction of global neutral silicone sealant industry in 2022
Current market situation and development prospect forecast of global UV sensitive resin 3D printer industry in 2022
Apache MPM model and ab stress test
[BMZCTF-pwn] 20-secret_ file
I've seen a piece of code in the past. I don't know what I'm doing. I can review it when I have time
[SQL injection point] location and judgment of the injection point