1. Use P1.0 to output 1KHz and 500Hz audio signals to drive the speaker as an alarm signal. It is required that the 1KHz signal sounds for 100ms and the 500Hz signal sounds for 200ms, alternately. P1.7 is connected to a switch for control. When the switch is closed, the alarm signal sounds. , when the switch is disconnected, the alarm signal stops and the program is programmed.
2. Circuit schematic diagram
The P1.0 port in the "MCU System" area is connected to the SPK IN port in the "Audio Amplification Module" area with a wire;
Connect an 8-ohm or 16-ohm speaker to the SPK OUT port in the "Audio Amplification Module" area;
Connect the P1.7/RD port in the "SCM System" area to the K1 port in the "Four-way Toggle Switch" area with a wire;
3. Program block diagram
4. Reference source program
FLAG BIT 00H
ORG 00H
START: JB P1.7, START
JNB FLAG, NEXT
MOV R2, #200
DV: CPL P1.0
LCALL DELY500
LCALL DELY500
DJNZ R2,DV
CPL FLAG
NEXT: MOV R2, #200
DV1: CPL P1.0
LCALL DELY500
DJNZ R2,DV1
CPL FLAG
SJMP START
DELY500: MOV R7, #250
LOOP: NOP
DJNZ R7,LOOP
RET
END
Previous article:Data type analysis in 51 microcontroller
Next article:Introduction to the functions of various system boards of AT89S51 microcontroller
- Popular Resources
- Popular amplifiers
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
- 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
- What do you most expect humanoid robots of the future to do: replace humans, serve humans, or surpass humans?
- TMS320VC33 Digital Signal Processor Data Sheet
- Is MOV an assembly instruction? The book I am reading now is called 51 Single-Chip Microcomputer C Language Application Development Trinity Practical Explanation. . .
- How to read circuit diagrams.pdf
- [Instrument Sharing] How to use an oscilloscope to monitor the waveform of a low-frequency signal? Adjusting these three keys is enough
- How does the MK60 serial port receive a string of indefinite length?
- Microchip live broadcast at 10:30 this morning | ADAS platform trusted root, learn technology and win gifts!
- Low-cost, high-precision digital control solution for battery testing equipment
- Random errors in XINTF read and write of F28335
- STM32L431 strange assignment problem?