Install burning software and add MCU
Since the chip I use is STC89C52, the STC series of microcontrollers are not integrated in the keil software, so I need to add it myself. So I log in to the STC official website http://www.stcisp.com to download the latest stc-isp software.
Then open stc-isp, select Keil simulation settings, and click to add the model and header file to Keil
Select the installation folder (the folder must include C51 and UVx, which is the installation directory of the Keil software)
Click OK, it will show that the STC MCU model has been added successfully, click OK and close the software.
Understanding the Principle
View the development board schematics
The LED schematic diagram of the development board used by the author is as follows, so we know that D1 is connected to the P20 interface.
LED lighting principle
Different light-emitting diodes have different forward conduction voltages, and the specific voltage drop depends on the diode query, but the same feature is that the positive voltage of the diode must be greater than the negative voltage. In the schematic diagram, the positive pole of the diode is connected to a resistor and then to Vcc, and the negative pole is directly connected to the P20 port. If Vcc is high, the P20 port is low. The resistor provides a voltage drop here to prevent the voltage at both ends of the D1 port from being too high and limit the current from being too large. So we get the parameters we need to set, the P20 port voltage is 0, that is, the parameter that needs to be set in Keil is that the P20 voltage is 0.
Programming
New Project
After creating a new project, select STC series and find the STC89C52 chip
Click OK and then select Yes to successfully create the project.
create a new file
Click new under File to create a new file, click Save, and the file extension will be .c
Double-click Source Group1 to add the file.
Compiling the code
Code
Click the magic wand and check the box next to the hex file under output.
Then compile the file, 0 warnings 0 errors and generate a hex file
Burn into MCU
Open the stc-isp software, select the MCU model, select the serial port number that is the same as the computer, then open the file and find the hex file just generated, which is usually under the generated Objects file
Select Download Programming and complete the operation when prompted
Now let’s take a look at the first LED light that lights up!
Previous article:Multi-mode 51 single-chip heart-shaped water light + breathing light + buzzer music
Next article:Microcontroller - Buzzer (Happy Birthday)
- 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
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- Why does TIM1_CH3N not output PWM after configuring PWM in STM32F103C8T6?
- Can you recommend a chip that can boost 3.3V to 5V?
- How to quickly gain points?
- [National Technology N32G457 Review] RT_Thread solves the problem that SPI NSS cannot be pulled low
- [Silicon Labs BG22-EK4108A Bluetooth Development Review] 1: IoT product introduction and BLE environment construction
- How does the company evaluate working from home?
- IIC protocol based on STM8--Example--Clock module (DS3231) reading
- A Implementation of Serial Interface Based on PCI Bus
- How to quickly design an infrared thermometer? Texas Instruments gives you tips!
- 【McQueen Trial】Blink