1. A board has the necessary power supply lines and the necessary simulation download and debug lines (such as J-link for STM32)
2. Install the development environment: keil4 (c51 or ARM series registration), it seems that there is also msp430 series. First, make sure what series the board is. IAR EWARM is (ARM series environment developed by IAR System)
3. Install the driver: various drivers in the software
4. Configure and select DEVICE in the development environment (there are many different devices registered for different series), and choose to download the debug driver
(1) Create a new project and save it in folder a
(2) Create a new file (refer to file standardization), save it in a, or copy the existing supporting files
(3) Add files to the project
5. The microcontroller has supporting Chinese information, files, and example programs
6. Compare the Chinese information, understand the functions of the supporting file functions, and use them (look carefully at the registers used)
Main() Function
1. Initialization function: generally there are system initialization, delay initialization, LED initialization, serial port initialization
2. Processing function: Do the main processing work. You can directly write the processing function without creating a new processing file.
File standardization: (You can refer to "STM32 Incomplete Manual")
1. The beginning of main() and other .c files must include the corresponding .h files
2. Generally, there are .c and .h files for system, delay and LED.
The .c file contains the corresponding processing functions, and the .h file contains various function name declarations and various macro definitions in the .c file.
The system file is mainly used to configure the corresponding function registers, and we mainly write the processing program.
How to download the program:
1. USB to serial port: software download, full-duplex asynchronous serial communication, USB cable connected to USB_232 to connect PL2303 (PL2303 driver needs to be installed), the data should have the corresponding download software, only a file generated by the development environment compilation (such as the .hex file generated by keil)
2. JTAG/Adapter: Hardware download, driver needs to be installed, select driver in Debug in Keil
The timer of the general microcontroller development board is used:
The program consists of two programs:
1.TIMER_Init() initialization program: configure system clock, enable switch, load value and other configuration registers
2. TIMER_IRQ() interrupt program entry: When the timer reaches the specified time, it jumps directly to the interrupt entry program operation.
General method for external interruption: (For details, see the external interruption experiment in the "STM32 Incomplete Manual")
The state change of the LED is controlled by controlling the high and low levels of the I/O port through external buttons.
1. Set the output mode of the I/O port (generally, the MCU I/O has several output modes: such as input/output, external interrupt, floating input, etc.), generally a pull-up resistor is required
2. Configure the external interrupt register and set the mapping relationship between the I/O port and the interrupt line
3. Configure registers and set trigger conditions, such as rising edge trigger, falling edge trigger, etc.
4. Configure the register bit to enable interrupts
5. Write an interrupt service function. When the microcontroller detects an interrupt on the I/O, it will execute the interrupt service program.
Previous article:Debounce of Buttons in MCU
Next article:Analysis of code for determining big and small ends
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
MoreDaily News
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Another technical solution for power-type plug-in hybrid: A brief discussion on Volvo T8 plug-in hybrid technology
Guess you like
- If your home could store energy, would you like it?
- What is synchronous logic and asynchronous logic?
- Is the current wired Ethernet half-duplex the same as the early Ethernet half-duplex?
- Today at 10:00 AM, we will present a live broadcast with prizes: Introduction to the deep learning platform based on TI Jacinto
- Differences between FPGA and DSP
- Eliminating Video Common-Mode Noise in Automotive and Industrial Environments
- Exynos4412-ARM processor has a lot of information but few bugs, practical projects + supporting videos + full source code
- FPGA and Digital Image Processing.docx
- Power IC Control Issues
- Flash the computer version