Based on the 51 microcontroller, the eight digital tube patterns are displayed as follows:
xxx11xxx→xx2222xx→x333333x→44444444→x555555x→xx6666xx→x777777x→88888888
Each state lasts one second, and the display cycles repeatedly, where x indicates that the corresponding digital tube is off.
Supplement to the question: It is a digital tube with a common anode, driven by a 595 chip. Using C language.
================================================== =
Best answer: The program design is completed, and the screenshots of PROTEUS simulation are as follows.
The procedure is as follows:
//==============================================
#include
#define uint unsigned int
#define uchar unsigned char
//HC595 chip
sbit H_ds = P2^0;
sbit H_shcp = P2^1;
sbit H_stcp = P2^2;
char code DISP_8[] = {
0x00, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f};
char code TAB_64[] = {
0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0,
0, 3, 3, 3, 3, 3, 3, 0, 4, 4, 4, 4, 4, 4, 4, 4,
0, 5, 5, 5, 5, 5, 5, 0, 0, 0, 6, 6, 6, 6, 0, 0,
0, 7, 7, 7, 7, 7, 7, 0, 8, 8, 8, 8, 8, 8, 8, 8};
char i = 1, j = 0;
char DISP_B[] = {0, 0, 0, 0, 0, 0, 0, 0};
//------------------------------------------------ ------------------
void sendbyte_H (uchar aa) //Use HC595 output
{
char z;
aa = ~aa;
for (z = 0; z < 8; z++) { //Loop 8 times to move in data
H_shcp = 0;
H_ds = aa & 128; //The data bits are sent to the HC595 data line
H_shcp = 1; //Input data on rising edge
aa "《= 1;
}
}
//------------------------------------------------ ------------------
void display()
{
char z;
for (z = 0; z < 8; z++) DISP_B[z] = TAB_64[j * 8 + z];
j++; j %= 8;
for (z = 0; z < 8; z++) sendbyte_H (DISP_8 [DISP_B [z]]);
H_stcp = 0; H_stcp = 1; //The rising edge causes data to be output in parallel
}
//------------------------------------------------ ------------------
void main()
{
TMOD = 0x01;
TH0 = (65536 - 46080) / 256; //50ms@11.0592MHz
TL0 = (65536 - 46080) % 256;
TR0 = 1;
ET0 = 1;
EA = 1;
while(1);
}
//------------------------------------------------ ------------------
void T0_time()interrupt 1
{
TL0 = (65536 - 46080) % 256; //Reset initial value
TH0 = (65536 - 46080) / 256; //50ms@11.0592MHz
i--;
if (i == 0) {
i = 40;
display(); //pattern display
}
}
//------------------------------------------------ ------------------
Previous article:Production of 51 microcontroller "building block" experimental board
Next article:Implementation method of communication between 51 microcontroller and computer
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- 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
- How to read the timing diagram--Detailed explanation of nand flash read operation
- FPGA Experiment (VI) SignalTap II parameter setting and waveform generation
- [Mill MYB-YT507 development board trial experience] Use Python to obtain computer memory and CPU information
- How to deal with idle pins in CMOS circuits
- "Practice together in 2021" + 2020 is my first year of letting go
- Ask everyone a question about chip manufacturing
- [Raspberry Pi 4B Review] Raspberry Pi 4 drives 3G network card to send and receive text messages and wireless Internet access
- ESP32 VL53L5CX Multi Zone Range Sensor
- Simple questions about DC motors
- Dual-receive and dual-transmit radio RF board based on XC7Z100+ADRV9009