The schematic diagram of the digital tube is as above. The corresponding numbers or characters are spelled out by lighting up the seven LEDs. The digital tube has a common anode (low level light) and a common cathode (high level light). Take the number 2 in the above figure as an example:
Common anode (0 on, 1 off): DP G F E D C B A
1 0 1 0 0 1 0 0 = 0xA4
Common cathode (1 on, 0 off): DP G FE D C B A
0 1 0 1 1 0 1 1 = 0x5B
Full definitions:
The attached Excel file contains all the codes for common anode and common cathode;
Taking the common anode as an example, define 0-9 in an array (called "table" in C language? Anyone who knows can enlighten me), and display 0-9 in sequence through a loop;
#include
unsigned char code dofly_table[10]={0xc0,0xf9,0xa4,0xb0,0x99,
0x92,0x82,0xf8,0x80,0x90,};
// Display value table 0-9
void Delay();
void main ()
{
unsigned char i;
while(1)
{
for (i = 0; i < 10; i++)
{
P1=dofly_table[i];
Delay();
}
}
}
void Delay() // 12M crystal oscillator 1s delay
{
unsigned char h, i, j, k;
for (h = 5; h > 0; h--)
for (i = 4; i > 0; i--)
for (j = 116; j > 0; j--)
for (k = 214; k > 0; k--); // The last one must have a ;
}
Previous article:Digital tube displays dynamic numbers
Next article:The digital tube displays the number corresponding to the key
Recommended ReadingLatest update time:2024-11-16 21:44
- 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
- PWM wide-frequency generator
- Ti CC2540 Bluetooth module study notes
- Silicon Labs BG22-EK4108A Bluetooth Development Review - Unboxing
- [2022 Digi-Key Innovation Design Competition] + Unboxing of Raspberry Pi 400, shocking news
- I copied the op amp circuit, but I don't understand the function of one component.
- Application of depletion-mode MOSFET in industrial sensors and smart transmitters
- Last two days! Free trial: Tailing Micro's new generation of low-power, high-performance multi-protocol wireless kit B91
- Award-winning live broadcast: Beneng International launches millimeter-wave radar module based on Infineon technology, perfectly solving the pain points of PIR market
- [RISC-V MCU CH32V103 Evaluation] 3. USB HID routine operation
- 01_Basic principles of static timing analysis and timing analysis model