Static digital tube
Hardware Hookup
The figure shows a common anode digital tube. The 8 segments of the digital tube are 8 LEDs. The anodes of the LEDs are connected together and connected to a high level. When the cathode of a segment is connected to a low level, the segment will light up.
software design
Put the segment codes from 0 to F into the array and display 0 to F in sequence.
unsigned char DIG_CODE[16]={0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07,0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71};
/****************************************************** ******************
* Function name: static_dig
* Function: Static digital tube displays in sequence
* Input: None
* Output: None
*************************************************** *************/
void static_dig(void)
{
unsigned char i = 0;
for (i=0; i<16; i++)
{
DIG = ~DIG_CODE[i];
delay1s();
}
}
Dynamic digital tube
Hardware Hookup
The bit selection segment of the digital tube is connected to the output of the 38 decoder. The segment selection terminal is connected to the output of the 74573 follower.
At a certain moment, only one digital tube can be lit. The intervals between the lighting of each digital tube can be shortened to take advantage of the afterglow effect of the human eye. It looks like all digital tubes are lit at the same time, showing different code values.
software design
unsigned char DIG_CODE[16]={0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07,0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71};
/****************************************************** **********
* Function name: dongtai_all
* Function: Each digital tube displays different contents in turn
* Input: None
* Output: None
*************************************************** **********/
void dongtai_all(void)
{
unsigned char i = 0;
for (i=0; i<8; i++)
{
WEI = i; //Bit selection, decide which digital tube is lit
DUAN = DIG_CODE[i+1]; //Segment selection, determines which segment of the digital tube lights up (which number lights up)
delay1s();
}
}
Previous article:Microcontroller learning record - LED dot matrix
Next article:Microcontroller learning record - relay
Recommended ReadingLatest update time:2024-11-16 19:58
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- I think the company is wasting money hiring me
- [DIY] Use mosquito repellent to modify wifi repeater, wifi signal booster
- Capacitive Touch Self-Capacitance Buttons, Sliders, Wheels, and Proximity Sensor Demo Board
- How is this comparator with hysteresis implemented?
- Precautions for using chip ferrite beads
- Introduction to Electromagnetic Compatibility by Clayton R.Paul
- Stare at pictures to find inspiration
- OpenHarmony 3.0 porting to Raspberry Pi 4B - learning record
- Calculation of the ripple rate r of the second inductor of the SEPIC circuit
- Common problems in designing microcontroller peripheral circuits