;Question requirements:
;Stopwatch timing, press S0 to start timing, and the digital tube will display;
;Press S0 again to stop. If S0 is not pressed to stop after counting for 1 minute, the buzzer will alarm.
;To simulate on the proteus software......
;===============================================================================
;The questioner gave a program. After modification, the required functions, except for the buzzer alarm, can be realized.
;The buzzer alarm is difficult to modify from the original program. It is recommended to change it to an LED light alarm.
;The program is as follows:
;----------------------------------------------
TEMP EQU 22H
ORG 0000H
SJMP START
ORG 0003H
LJMP X0_INT
ORG 0050H
;----------------------------------------------
START:
MOV IE, #85H
MOV IP, #00000001B
MOV TEMP, #0
;----------------------------------------------
M_LOOP:
CALL DISPLAY
CALL DELAY2 ;Delay about 500ms
CALL DELAY2
JNB F0, NEXT
INC TEMP
MOV A, TEMP
CJNE A, #61, NEXT
CLR P0.1
MOV TEMP, #60
NEXT:
SJMP M_LOOP ;One loop, about 1s
;----------------------------------------------
X0_INT:
CPL F0
JB P0.1, X0_END
SETB P0.1
MOV TEMP, #0
X0_END:
JNB P3.2, $
RETI
;----------------------------------------------
DISPLAY:
MOV DPTR, #NUMTAB ;Specify table address
MOV A, TEMP
MOV B, #10
DIV AB ;A/B quotient = a, remainder = b
MOVC A, @A+DPTR ;Check the ten-digit seven-segment code
MOV P1, A ;Send the ten-digit seven-segment code
MOV A, B ;The ones digit is in b
MOVC A, @A+DPTR ;Check the ones digit seven-segment code
MOV P2, A ;Send the ones digit seven-segment
RET
;----------------------------------------------
NUMTAB:
DB 0C0H,0F9H,0A4H,0B0H,099H
DB 092H,082H,0F8H,080H,090H
;----------------------------------------------
DELAY2: ; Delay about 500ms
MOV R5, #10
DEL3: MOV R6, #100
DEL4: MOV R7, #248
DJNZ R7, $
DJNZ R6, DEL4
DJNZ R5, DEL3
RET
END
;----------------------------------------------
; The program is run with PROTEUS, and the screenshot is as follows:
Previous article:Using the Bubble Method to Write a Sorting Program for 51 Single Chip Microcomputer
Next article:Simple digital frequency meter based on 51 single chip microcomputer
- 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
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- 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
- sdram_datasheet.pdf
- The book on switching power supplies states that because the capacitor is charged in each cycle, the current decline slope continues to increase. How do you understand this?
- [TI recommended course] #In-depth study of light load high efficiency and low noise power supply reference design for wearable devices and the Internet of Things (TIDA-01566)#
- Mastering the Linux kernel: core technology for smart device development
- If you are interested in learning robot development, please take a look.
- Power Amplifier Basics
- What's wrong with Atmel Studio 7.0?
- Ready to use, STM32L452 project of LPS22HH
- OfficeSuite software for mobile reading and document editing
- New neopixel usage on STM32