(2) Allocate system resources and storage units;
(3) Draw a program flow chart;
(4) Design the program and repeatedly debug and modify it.
Colorful Light Cycle Design
ORG 0000H
MAIN: MOV P1, #80H ;D7 light
MOV P1, #40H ;D6 light
MOV P1, #20H ;D5 light
MOV P1, #10H ;D4 light
MOV P1, #08H ;D3 light
MOV P1, #04H ;D2 light
MOV P1, #02H ;D1 light
MOV P1, #01H ;D0 light
SJMP MAIN ; loop
ORG 0000H
MAIN: MOV A, #01H ; initial state
MOV R0, #08 ; 8 bits in total
L1: MOV P1, A ; D1 lights up
LCALL DEL ; delay subroutine
RL A ; state moves up 1 bit
DJNZ R0, L1; loop judgment
SJMP MAIN ; loop
Previous article:Working principle of matrix keyboard
Next article:Introduction to single chip microcomputer programming methods (delay program, subroutine, loop program)
- 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
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Sandia Labs develops battery failure early warning technology to detect battery failures faster
- TMS320F28379D User Experience SCI
- TMS320F28335 Study Notes - Startup Process
- Is SUNSCO a single-chip microcomputer model?
- What are the factors that affect the power consumption of microcontrollers?
- Review of the 2019 National Electronic Design Competition - The small plane I made
- [TI recommended course] #DC/DC switching regulator packaging innovation#
- Renesas CPK-RA2L1 development board first step development environment construction
- Working principle of LM393 voltage comparator
- The difference between MCU interface and RGB interface
- [RISC-V MCU CH32V103 Review] 5. Real breathing light