当前位置:网站首页>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
边栏推荐
- Small sample target detection network with attention RPN and multi relationship detector (provide source code, data and download)
- Notes | numpy-08 Advanced index
- Prepare for 2022 and welcome the "golden three silver four". The "summary of Android intermediate and advanced interview questions in 2022" is fresh, so that your big factory interview can go smoothly
- Do you know UVs in modeling?
- 2022 new examination questions for the main principals of hazardous chemical business units and examination skills for the main principals of hazardous chemical business units
- Thesis reading_ ICD code_ MSMN
- Problems encountered in fuzzy query of SQL statements
- [clock 223] [binary tree] [leetcode high frequency]: 102 Sequence traversal of binary tree
- Market status and development prospect prediction of global fermentation acid industry in 2022
- General undergraduate college life pit avoidance Guide
猜你喜欢
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
[tools run SQL blind note]
Oracle SQL table data loss
联发科技2023届提前批IC笔试(题目)
2022 tea master (intermediate) examination questions and tea master (intermediate) examination skills
Web security - CSRF (token)
Silent authorization login and registration of wechat applet
带有注意力RPN和多关系检测器的小样本目标检测网络(提供源码和数据及下载)...
The usage of micro service project swagger aggregation document shows all micro service addresses in the form of swagger grouping
Coordinatorlayout appbarrayout recyclerview item exposure buried point misalignment analysis
随机推荐
The consumption of Internet of things users is only 76 cents, and the price has become the biggest obstacle to the promotion of 5g industrial interconnection
C language self-made Games: Sanzi (tic tac toe chess) intelligent chess supplement
Handler understands the record
ZABBIX monitoring of lamp architecture (3): zabbix+mysql (to be continued)
Do you know UVs in modeling?
Introduction to JVM principle
Prepare for 2022 and welcome the "golden three silver four". The "summary of Android intermediate and advanced interview questions in 2022" is fresh, so that your big factory interview can go smoothly
Market status and development prospect prediction of global fermentation acid industry in 2022
2022 t elevator repair simulation examination question bank and t elevator repair simulation examination question bank
文献阅读_基于多模态数据语义融合的旅游在线评论有用性识别研究(中文文献)
Number of 1 in binary (simple difficulty)
Review the old and know the new: Notes on Data Science
2022 chemical automation control instrument examination summary and chemical automation control instrument certificate examination
General undergraduate college life pit avoidance Guide
C Primer Plus Chapter 10, question 14 3 × 5 array
Huawei personally ended up developing 5g RF chips, breaking the monopoly of Japan and the United States
Crazy scientist
第十九届浙江省 I. Barbecue
Summary of training competition (Lao Li's collection of questions)
Notes | numpy-11 Array operation