Experimental simulation diagram
Source code: (The playing part of the code is temporarily removed, please forgive me, please leave a message if you need it, please indicate the source if you reprint it, thank you!)
MAIN:
MOV DPTR,#LED0
MOV A,#00H
MOVX @DPTR,A
NEXT:
;Determine the base address of different songs
START1:
START2:
START3:
;Keyboard playing program entry
KEYPLAY:
; Determine the base address of high, medium and low frequencies
LOWTONE:
MIDDLETONE:
HIGHTONE:
;Song playing program
NEXT1: MOV DPTR,#SEG7
SING:
D1:
END0:
[page]
;Key query program
KEY:
;Key software anti-shake program
M0:
M1:
M2:
M3:
M4: LCALL
M5:
M6:
; Determine the offset address of the key program
M00:
M11:
M22:
M33:
M44:
M55:
M66:
;Key tone playing program
;Note corresponding timer initial value table:
TABLE1:
DW 64580,64684,64777,64820
DW 64898,64968,65030,64260
DW 64400,64524,65058,63835,64021
LOWTABLE:
DW 63628,63835,64021,64103,64260,64400,64524
MIDDLETABLE:
DW 64580 ,64684,64777,64820,64898,64968,65030
HIGHTABLE:
DW 65058,65110,65157,65178,65217,65252,65283
SEG7:
DB 06H, 5BH, 4FH,66H, 6DH, 7DH,07H
;音符节拍表:
TABLE:
DB 02H,82H
DB 16H,32H,54H,02H,52H
DB 0A6H,32H,54H,02H,52H
DB 64H,74H,0B6H,64H
DB 52H,5CH,32H,22H
DB 16H,12H,14H,32H,22H
DB 16H,12H,14H,22H,32H
DB 26H,12H,94H,22H,32H
DB 2CH
DB 32H,52H
DB 36H,22H,14H,54H
DB 0ACH,92H,0A2H
DB 96H,0A2H,96H,82H
DB 3CH,54H
DB 36H,22H,14H,54H
DB 0ACH,92H,0A2H
DB 16H,12H,14H,22H,32H
DB 2CH,02H,82H
DB 16H,32H,56H,12H
DB 0A6H,32H,56H,52H
DB 66H,72H,0B6H,62H
DB 62H,52H,58H,32H,22H
DB 16H,12H,14H,32H,22H
DB 16H,12H,14H,22H,32H
DB 26H,92H,0A4H,12H,22H
DB 1CH
DB 00
TABLE2:
DB 88h,14h,24h,36H,42H,34H,14H,28H,14H,94H
DB 1fH,88H,14H,24H,34H,32H,42H,54H,14H
DB 46H,32H,54H,22H,32H,32H,22H,2CH,38H,54H,74H
DB 76H,62H,68H,54H,52H,62H,74H,62H,52H,3fH
DB 46H,42H,54H,64H,54H,42H,32H,28H,0a4H,0a2H
DB 92H,84H,94H,1fH,0b8H,68H,46H,52H,68H
DB 74H,72H,72H,74H,62H,52H,3fH,0b8H,68H
DB 46H,52H,68H,64H,62H,62H,64H,42H,32H,2fH
DB 58H,14H,24H,36H,42H,34H,12H,12H,26H,22H,24H,22H,12H
DB 94H,9cH,0a8H,0a6H,92H,84H,64H,54H,22H,22H,46H,42H,44H,32H,22H,5fH
DB 00
TABLE3:
DB 82H,92H,12H,14H,12H,14H,92H,82H,12H,14H,22H,14H,92H,12H,22H,24H
DB 22H,24H,12H,92H,22H,24H,32H,24H,32H,52H,62H,54H,52H,64H,52H,32H
DB 22H,32H,22H,12H,94H,82H,92H,12H,14H,12H,14H,94H,1cH
DB 82H,92H,12H,14H,12H,14H,92H,82H,12H,14H,22H,14H,92H,12H,22H,24H
DB 22H,24H,12H,92H,22H,24H,32H,24H,32H,52H,62H,54H,52H,64H,52H,32H
DB 22H,32H,22H,12H,94H,82H,92H,12H,14H,12H,14H,22H,12H,1cH,32H,52H
DB 62H,64H,62H,64H,0b2H,62H,52H,54H,62H,54H,32H,22H
DB 12H,14H,12H,14H,24H,3cH,32H,22H,12H,14H,12H,14H,0b2H,62H,52H,54H,62H,54H,32H,52H
DB 66H,0b2H,0b4H,62H,52H,5cH,32H,52H,62H,64H,62H,64H,0b2H,62H,52H,54H
DB 62H,54H,32H,22H,12H,14H,12H,14H,54H,3cH,32H,22H,12H,14H,12H,14H,22H,32H
DB 52H,54H,32H,54H,32H,52H,6fH,04H,02H,92H,32H,24H,12H,1fH
DB 00
END
Previous article:Some keywords in 51 single chip microcomputer (continuously updated)
Next article:Programming an 8-way Color Light Control System Using Assembly Language
- 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
- 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
- Why software-defined vehicles transform cars from tools into living spaces
- [ESP32-Audio-Kit Audio Development Board Review] 1. Unboxing photos and official information, first power-on
- EEWORLD University ---- Robust Control Theory
- 【GD32307E-START】+ TFT screen driver and icon interface drawing
- [Registration Open] RISC-V Security Zone | Microchip Security Solutions Seminar Series
- 【AT-START-F403A Review】Part 4: IIC driving OLED screen
- Reading notes on "Operational Amplifier Parameter Analysis and LTspice Application Simulation"
- MSP430 MCU key test KEY function
- MPS430F149 MCU_Wireless transmission module based on MSP430 MCU.c
- How to learn C language in depth
- High efficiency Doherty amplifier