Simulation schematic diagram:
Program operation chart:
Part of the program:
#include #define uchar unsigned char #define uint unsigned int uchar duan[10]={0xc0,0Xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; //The bit code of the required segment //uchar wei[4]={0XEf,0XDf,0XBf,0X7f}; //bit control end (development board) uchar wei[4]={0X80,0X40,0X20,0X10}; //bit control terminal (simulation) uint z,x,c,v, date; //Define data type uint dispcount=0; uint lck=0; uint disp=0; /****************************************************** ***************** P2=wei[3]; P0=duan[v]; delay(50); } /****************************************************** ************************ Timer initial value 1ms *************************************************** ************************/ void initTimer(void) { TMOD=0x0; TH0=0xe3; TL0=0xc; } /****************************************************** ************************ timer function *************************************************** ************************/ void timer0(void) interrupt 1 { TH0=0xe3; TL0=0xc; lck++; if(lck==1000) { disp=dispcount; lck=0; dispcount=0; } } /****************************************************** ************************ Interrupt function *************************************************** ************************/ void int0(void) interrupt 0 { dispcount++; //for each interrupt, the count increases by one } /****************************************************** ************************ main function *************************************************** ************************/ void main(void) { IT0=1; //INT0 falling edge interrupt EX0=1; //Allow INT1 interrupt initTimer(); //Load the initial value TR0=1; ET0=1; EA=1; while(1) { date=disp; xianshi(); } }
Previous article:Design of intelligent car system based on 51 microcontroller
Next article:Design of sine wave generator based on 51 microcontroller
- Popular Resources
- Popular amplifiers
- 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)
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
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- Weekly review information is here~
- Learning Linux kernel semaphores on SinlinxA33 development board
- STM32 encoder signal interference.
- [GD32L233C-START Evaluation] +ADC collects PT1000 to obtain temperature
- Three traditional methods of wireless video transmission
- Essential for EMC Electronic Engineers
- Can you help me take a look at this FPGA development board?
- FLUKE is hiring!
- FPGA realizes digital tube counting
- MSP430FW42X Non-Magnetic Sensor Water Meter Solution