当前位置:网站首页>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

边栏推荐
- Uipath practice (08) - selector
- Notes | numpy-07 Slice and index
- Introduction to message queuing (MQ)
- Market status and development prospect prediction of global neutral silicone sealant industry in 2022
- 并发操作-内存交互操作
- [BMZCTF-pwn] 18-RCTF-2017-Recho
- [luatos sensor] 1 light sensing bh1750
- 2022 a special equipment related management (elevator) analysis and a special equipment related management (elevator) simulation test
- Shell script Basics - basic grammar knowledge
- SSM framework integration
猜你喜欢
![[luatos sensor] 1 light sensing bh1750](/img/70/07f29e072c0b8630f92ec837fc12d5.jpg)
[luatos sensor] 1 light sensing bh1750

ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation

Sdl2 + OpenGL glsl practice (Continued)

7. Integrated learning

M1 Pro install redis

Handler understands the record

Review the configuration of vscode to develop golang

Triangular rasterization
![[PCL self study: filtering] introduction and use of various filters in PCL (continuously updated)](/img/36/53886b9d3b98f744be2b6aa6b5d3eb.jpg)
[PCL self study: filtering] introduction and use of various filters in PCL (continuously updated)

Thesis reading_ Chinese NLP_ ELECTRA
随机推荐
Retirement plan fails, 64 year old programmer starts work again
Market status and development prospect prediction of the global fire alarm sensor industry in 2022
移动端——uniapp开发记录(公共请求request封装)
2.14 summary
Shell script -- condition judgment
The principle is simple, but I don't know how to use it? Understand "contemporaneous group model" in one article
[SQL injection point] location and judgment of the injection point
sql语句模糊查询遇到的问题
Triangular rasterization
Market status and development prospect prediction of the global autonomous hybrid underwater glider industry in 2022
Web security - CSRF (token)
The 19th Zhejiang I. barbecue
"Niuke brush Verilog" part II Verilog advanced challenge
普通本科大学生活避坑指南
Thesis reading_ Tsinghua Ernie
Current market situation and development prospect forecast of global UV sensitive resin 3D printer industry in 2022
[PCL self study: filtering] introduction and use of various filters in PCL (continuously updated)
Notes | numpy-07 Slice and index
论文阅读_中文医疗模型_ eHealth
Symbol of array element product of leetcode simple problem