#include <STC89C5xRC.H>
void delay()
{
int i, j;
for(i = 0; i < 15; i++)
for(j = 0; j < 15; j++) ;
}
void disp_digit()
{
int d = 60; //number to be displayed
unsigned char code DIG_CODE[10] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f};
while(1)
{
//Display the single digit
P2 = 0; // P2 = 0 -> (P24, P23, P22) = (0, 0, 0) -> the first number from the right lights up
P0 = DIG_CODE[d % 10];
delay();
//Display the tens digit
P2 = 1 << 2; //P2 = 0000 0100 -> (P24, P23, P22) = (0, 0, 1) -> the second digit from the right lights up
P0 = DIG_CODE[d / 10];
delay();
}
}
int main()
{
disp_digit();
return 0;
}
Previous article:8051 MCU (STC89C52) countdown timer
Next article:8051 MCU serial port complex command reception and analysis
- 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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- How to remove the AD official logo from the PCB template
- Requirements for using IAR ETM Trace debugging features
- Will the basic technology of PA become more complex with the advent of the 5G era?
- [NXP Rapid IoT Review] Unboxing photos and simple connection test
- [Reprint] Open-loop full sine sensorless FOC
- [Project source code] Use of digital filter based on FPGA
- GD32F310 series introduction and data download
- CB5654 Development Board Review 5——Compiling in Linux Environment (But Burning Failed)
- [Gizwits Gokit3 Review] + Unboxing Review
- Some companies provide employees with two computers