1. Experimental tasks
Use the AT89S51 timer/counter T0 to generate a 2-second timing. Whenever the 2-second timing arrives, the replacement indicator light flashes. The frequency of each indicator flash is 0.2 seconds. That is to say, the L1 indicator light starts at a rate of 0.2 seconds. Flashing, when the 2-second timer arrives, L2 starts flashing at a rate of 0.2 seconds, and the cycle continues. The flashing rate of 0.2 seconds is also completed by the timer/counter T0, which is a flashing light.
2. Circuit schematic
Figure 4.16.1
3. System board hardware wiring
(1. Connect P1.0-P1.3 in the "MCU System" area to L1-L4 in the "Eight-way LED Indicator Module" area with wires
4. Programming content
(1. Since it is done in the interrupt mode, the interrupt source must have its interrupt entry address. For the timer/counter T0, the interrupt entry address is 000BH, so a long jump instruction is added to the interrupt entry to perform the interrupt service. Program. The format of writing assembly source program is as follows:
ORG00H
LJMPSTART
ORG0BH ;Timer/counter T0 interrupt entry address
LJMP INT_T0
START: NOP; main program starts
.
.
INT_T0: PUSH ACC; timer/counter T0 interrupt service routine
PUSH PSW
.
.
POP PSW
POP ACC
RETI; Interrupt service routine returns
END
(2. Timing 2 seconds, using 16-bit timing 50ms, a total of 40 times to reach 2 seconds. An interrupt is generated every 50ms. The 40 times of timing are completed in the interrupt service program. The same timing of 0.2 seconds requires 4 times. It can reach 0.2 seconds. For the interrupt program, the interrupt must be disconnected in the main program.
(3. Since each time the 2-second timer expires, L1-L4 will flash alternately. ID numbers are used to identify them. When ID = 0, L1 is flashing, when ID = 1, L2 is flashing; when ID = 2 When, L3 is flashing; when ID=3, L4 is flashing
5. Block diagram
T0 interrupt service program block diagram
Previous article:How to use AT89S51 microcontroller to realize the design of home voice alarm system
Next article:Design of AT89C52 microcontroller to light up the digital tube
Recommended posts
- EEWORLD University Hall----Live Replay: Anlu's new FPSoC product SF1 series FPGA+MCU, Demo board introduction and case analysis
- Livereplay:Anlu'snewFPSoCproductSF1seriesFPGA+MCU,demoboardintroductionandcaseanalysis:https://training.eeworld.com.cn/course/67940
- hi5 Integrated technical exchanges
- 【Qinheng Trial】7. TouchKey
- ThisexperimentusesthetouchbuttonfunctionoftheADCmoduleonCH549,andusesthefourtouchbuttonsK1,K2,K3,andK4connectedtoP00,P01,P02,andP03ontheCH549EVTlearningdevelopmentboardtocontrolthefourLEDsconnectedtoP22,
- lising Domestic Chip Exchange
- 【Ateli AT-START-F435】GPIO Interpretation (ODR, SCR, HDRV maximum current driving/sinking capability)
- AT32F435supportsupto116bidirectionalI/Opins,whicharedividedinto8groups,namelyPA0-PA15,PB0-PB15,PC0-PC15,PD0-PD15,PE0-PE15,PF0-PF15,PG0-PG15,PH0-PH3.Eachpincanrealizethefunctionsofexternalcommunication,controland
- zhangbaoyin Domestic Chip Exchange
- 【Anxinke BW16-Kit】Unboxing and First Experience
- TheBW16-KitdevelopmentboardconsistsoftheASINCOBW16moduleandthebaseboard.TheBW16moduleusestheREALTEKRTL8720DNdual-bandWi-Fi+BluetoothSoCsolution,integratingARMV8(compatiblewithCortex-M4F)high-performanceMCU,ARMV8
- dirty RF/Wirelessly
- Peripheral circuit design issues of synchronous buck chip
- Asshowninthefigure,therearetworecommendedapplicationdiagramsintheusermanualofthesynchronousbuckchipMPQ4323.ItalsoclearlyexplainstheperipheraldesignofPIN4,thefrequencysettingpin,andusesanexternalresistortogroun
- shaorc Power technology
- [Digi-Key Follow me Issue 2] Custom Task: ESP32 Controlled Amplifier
- Inthesecondphaseoftheevent,IboughtXIAOESP32C3tocompletetheorder.ItsupportsArduinodevelopment,isveryconvenient,andhasaveryminisize.Theboardcomeswithalithiumbatterychargingchip,andisveryplayable. TheAD52
- dql2016 DigiKey Technology Zone
- 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
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- I bought 8 apples last week and ate one every day, starting with the small ones. The last one had a rotten hole in it, so...
- node-red simulates LED flashing light control system program
- Are Decoupling Capacitors Really What You Need?
- 【i.MX6ULL】Driver Development 3——GPIO Register Configuration Principle
- 【Renovation of old things】 Finished product of graffiti desk lamp
- Prototyped a PCB expansion board
- [Practical sharing] Sharing of analog circuit diagrams commonly used by electronic engineers
- MSP432 MCU realizes speech recognition technology
- [Evaluation of EC-01F-Kit, an NB-IoT development board] - Temperature, humidity and atmospheric pressure equipment based on GD32F350 (completed)
- Dear experts, please help me, I can't figure out what's wrong