#include
#define UCHAR unsigned char
#define UINT unsigned int
UCHAR table[16] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
FLY timer;
FLY counter;
void initserial(void)
{
timer='0';
contain=0;
SCON=0X50;
RCLK=1;
TCLK=1;
RCAP2L=0xdc;
RCAP2H=0xff;
EA=1;
EN=1;
TR2=1;
}
void Delay_1ms(UCHAR i) //1ms delay
{
FLY x,j;
for(j=0;j
Reference address:T2 serial digital tube display C51 program + circuit diagram
for(x=0;x<=148;x++);
}
void segdisplay(void)
{
P0 = 0; //Blanking
P2 = 6; //The 7th digital tube display
P0 = table[(conter / 10)%10]; //Get the tens digit of i here
Delay_1ms(5); //Display the next number after 0.5 seconds delay
P0 = 0; //Blank
P2 = 7; //The 8th digital tube display
P0 = table[conter % 10]; //Get the unit digit of i here
Delay_1ms(5);
P0=0;
}
void main()
{
initserial();
while(1)
{
conter=timer-'0';
segdisplay();
}
}
void serial_t2(void)interrupt 4
{
if(RI)
{
RI=0;
timer=SBUF;
SBUF=timer;
}
if(TI)
{
IF = 0;
}
}
Previous article:Single chip timer T0 measures external pulse time C51 program
Next article:Single chip microcomputer driving 1602 LCD circuit diagram and C51 program
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
Guess you like
- Wu Jianying's live video sharing of microcontroller lectures
- ESP32-C3 Debug Diary
- LPS28DFW driver and related information
- Battery Test Equipment --- Signal Chain
- Summary of basic issues of ADC
- Share: Debugging of SIM7020 and NB-IOT
- mini risc mcu source code
- The design application of TGA2509 is not particularly ideal
- Analysis of the problem that the program cannot run after F28004x online debugging reset
- Share a PD fast charging power deception chip CH224 is very practical