Code:
#include #include #define uchar unsigned char #define uint unsigned int void DelayMS(uint x) { flying i; while(x--) { for(i=200;i>0;i--); } } void Move_LED() { if((P1 &= 0x10)==0) P0 = _cror_(P0,1); else if((P1 &= 0x20)==0) P0 = _crol_(P0,1); else if((P1 &= 0x40)==0) P2 = _cror_(P2,1); else if((P1 &= 0x80)==0) P2 = _crol_(P2,1); } void main() { uchar Recent_Key=0xff; P0=0xfe; P1=0xfe; P2=0xfe; while(1) { if(Recent_Key != P1) { Recent_Key=P1; Move_LED(); DelayMS(10); } } } Hardware Connection:
Previous article:Single chip buzzer happy birthday song
Next article:8-bit common anode digital tube scrolling display single digit
- 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
- Embedded development: How to select a microcontroller?
- Texas Instruments has the answers to the eight major challenges of automotive electrification!
- MSP430 communication resources IIC communication
- [Seeking guidance] RSL10 small light does not flash
- The weekly review information is here~ New activities will be launched this week
- How to use 3.3V of stm32 to control 5V servo?
- JD642 SDRAM bus matching pre-simulation and pcb download
- Help: I wrote a program using DS18B20 but I don’t know why it only displays 85 degrees Celsius. Please help me figure out what to do.
- How to flip and restore the PCB in Altium Designer 19 in 3D
- [STM32WB55 Review] 6# Use of STM32WB development board UART