Circuit diagram of digital tube part
program:
#include
#define UCHAR unsigned char
#define UINT unsigned int
sfr WDT_CONTR = 0xe1;
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;
TMOD=0X20;
SCON=0X50;
TL1=0xFD;
TH1=0xFD;
EA=1;
EN=1;
TR1=1;
}
void Delay_1ms(UCHAR i) //1ms delay
{
FLY x,j;
for(j=0;j
Reference address:51 MCU serial port T1 plus watchdog program
for(x=0;x<=148;x++);
}
void segdisplay(void)
{
P0 = 0; //Blanking
P2 = 6; //The 7th digital tube displays
P0 = table[conter / 10]; //Get the tens digit of i here
Delay_1ms(5); //Display the next number after 0.5 seconds delay
P0 = 0; //Blanking
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();
WDT_CONTR=0x3c;
while(1)
{
conter=timer-'0';
segdisplay();
WDT_CONTR=0x3c;
}
}
void serial_t2(void)interrupt 4
{
if(RI)
{
RI=0;
timer=SBUF;
SBUF=timer;
}
if(TI)
{
IF = 0;
}
}
Previous article:C51 MCU timer T2 countdown program + circuit diagram
Next article:LCD1602 experimental routine based on 51 single chip microcomputer
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
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
- 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
Guess you like
- 34063 output -6.5V
- How about domestic isolation chips (non-optocouplers)?
- SparkRoad Review (6) - Simple Traffic Light and Multi-File Project
- Use AM5728 EVM to make and download 6678 program
- Comments are rewarded | [Discovery] Enter the world of TI millimeter-wave radar and quickly acquire design skills
- Who has a domestic 20pin OTP microcontroller with ADC, and it must be cheap?
- 【Reward Sharing】Experience MPS Online Design Tools Together
- 【micropython】Bluetooth module has been added to ESP32
- Weekly evaluation information, delivered on time
- 97% off e-coins (can join in group)