Design a program for the 51 single-chip microcomputer. It is known that the crystal oscillator frequency of the 89C51 single-chip microcomputer is 12MHz, and
it is required to use T1 timing to output square waves with periods of 2ms and 500 microseconds at the P1.0 and P1.1 pins respectively.
Best answer:
;===================================================
The assembly program is as follows:
ORG 0000H
SJMP START
ORG 000BH
SJMP T0_INT
;------------------------------------
START:
MOV TMOD, #2 ;T0 timing mode 2
MOV TH0, #6 ;Can automatically load the initial value.
MOV TL0, #6 ;Timing
SETB TR0 ;Start T0
MOV IE, #82H ;Enable T0 interrupt.
SJMP $ ;Wait for interrupt.
;------------------------------------
T0_INT: ;Execute once every 250us.
CPL P1.1 ;Output square wave with a period of 500us.
INC B
MOV C, B.2
MOV P1.0, C ;Output square wave with a period of 2000us.
RETI
;------------------------------------
END
The above procedure has been verified by PROTEUS.
Previous article:Simple digital frequency meter based on 51 single chip microcomputer
Next article:Design of Second and Minute Pulse Generator of Single Chip Microcomputer by Interrupt Method
- 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
- 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
- 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
- A question about Datasheet?
- The E-coin exchange page has been completely revamped, with more surprises waiting for you to discover!
- The difference between various chips in TI's CC series: CC2430 CC1100
- happy holidays
- 【Tuya BK7231N】Unboxing Experience
- PIC32_CANbus cannot receive signal
- New package cannot be saved
- Technical characteristics and wide application of embedded systems
- Student dormitory apartment monitoring system based on Internet of Things
- 【DIY】Make a 5V input car light controller