1. Find the minimum system schematic diagram of C51
The development board you bought online must have a CD with a schematic diagram. First find the minimum system schematic diagram. This schematic diagram shows what the CPU I/O interface is connected to. And the I/O ports are numbered.
2. Find the LED module schematic
As can be seen from the figure below, each of the 8 interfaces of the P1 group I/O port is connected to an LED light, and when a port on P1 is at a low level, the LED will light up.
3. Programming
#include
sbit LED0=P1^0; // Use your own logo LED0 to represent I/O port P1^0
sbit LED1=P1^1;
void main()
{
LED0 = 0; //P1^0 port gives low level
LED1 = 0; //P1^1 port gives low level
while(1); //Do not let the program end to prevent it from running away or freezing.
}
4 Flowing Water Lights
#include
sbit LED0=P1^0;
sbit LED1=P1^1;
sbit LED2=P1^2;
sbit LED3=P1^3;
sbit LED4=P1^4;
sbit LED5=P1^5;
sbit LED6=P1^6;
sbit LED7=P1^7;
void delay(unsigned int i) //ÑÓ³Ùº¯Êý
{
while(--i);
}
void main()
{
while(1)
{
LED0=0;
delay(2000);
LED0=1;
delay(2000);
LED1=0;
delay(2000);
LED1=1;
delay(1000);
LED2=0;
delay(2000);
LED2=1;
delay(2000);
LED3=0;
delay(2000);
LED3=1;
delay(2000);
LED4=0;
delay(2000);
LED4=1;
delay(2000);
LED5=0;
delay(2000);
LED5=1;
delay(2000);
LED6=0;
delay(2000);
LED6=1;
delay(2000);
LED7=0;
delay(2000);
LED7=1;
delay(2000);
}
}
Previous article:(C51 Learning 2) Light up the digital tube
Next article:[MCU Notes] Solution to the problem that the Keil C51 compilation environment cannot jump to a function
- 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
- 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
- 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
- In the 5G era, IoT technology empowers smart healthcare
- Sony HT-Z9F speaker system disassembled with Rockchip RKNanoD chip
- Help! Why can the command sent by the microcontroller only display up to the fourth step?
- Future Outlook of IoT
- msp430g2553 hardware IIC
- The role, advantages and disadvantages of solid-state relays
- The Internet of Things helps smart agriculture, and farmers can also become technology workers
- MicroPython several issues
- ST NUCLEO-H743ZI Review Summary
- 【Featured Q&A】About battery protection and fuel gauge design