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

边栏推荐
- [luatos sensor] 2 air pressure bmp180
- Interface frequency limit access
- SSM framework integration
- Market status and development prospect forecast of global button dropper industry in 2022
- 关于开学的准备与专业认知
- Source insight garbled code solution
- Mobile terminal - uniapp development record (public request encapsulation)
- Keepalived热备与HAProxy
- Cross platform plug-in flutter for displaying local notifications_ local_ notifications
- 【PHP漏洞-弱类型】基础知识、php弱相等、报错绕过
猜你喜欢

Number of 1 in binary (simple difficulty)

2022 registration examination for safety production management personnel of hazardous chemical production units and examination skills for safety production management personnel of hazardous chemical

Analysis of proxy usage of ES6 new feature

Review the old and know the new: Notes on Data Science

Silent authorization login and registration of wechat applet

移动端——uniapp开发记录(公共请求request封装)

Contents of welder (primary) examination and welder (primary) examination in 2022

并发操作-内存交互操作
![[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa](/img/a9/92059db74ccde03b84c69dfce35b37.jpg)
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa

Source insight garbled code solution
随机推荐
论文阅读_清华ERNIE
【SQL注入点】注入点出现位置、判断
2022 a special equipment related management (elevator) analysis and a special equipment related management (elevator) simulation test
JDBC database operation
雇佣收银员(差分约束)
The process of browser accessing the website
Leetcode simple question: check whether two string arrays are equal
Thesis reading_ ICD code_ MSMN
Hire cashier (differential constraint)
Oracle SQL table data loss
Wechat applet distance and map
Valentine's day limited withdrawal guide: for one in 200 million of you
2.14 summary
String matching: find a substring in a string
Without 50W bride price, my girlfriend was forcibly dragged away. What should I do
Symbol of array element product of leetcode simple problem
Career planning of counter attacking College Students
Notes | numpy-09 Broadcast
The current market situation and development prospect of the global gluten tolerance test kit industry in 2022
[SQL injection point] location and judgment of the injection point