当前位置:网站首页>Create a new STM32 project and configure it - based on registers

Create a new STM32 project and configure it - based on registers

2022-07-25 06:32:00 an520_

stay keil5 New China STM32 Engineering documents of , The project is based on STM32F103.

1. Create a new folder , Name yourself according to the project to be carried out “ Ultrasonic ranging ”, Also create a new one internally “USER”;

2. open keil, from “Project” choice “New μVision Project...”, Here's the picture :

3. Locate the project to “ Ultrasonic ranging ” Of “USER” Under the table of contents , Then name it according to your own needs ;

4. Then a selection box will pop up , According to our own STM32 Select corresponding “STMicroelectronics”;

5. Click on “Cancel”;

6. First select the startup file , Punctual atoms have also been described in the documentation , As shown below :

ST The company provides 3 Give us a startup file , Used for different capacities STM32 chip , These three documents are :

C8T6 yes 64Kb, Therefore, it belongs to medium capacity , The startup file should select "startup_stm32f10x.md.s".

7. Then add the startup file to the project ; 

Of course, you can also right-click from "Manage Project items" Add , It's not shown here .

8. Because the startup file is different , So the code will be different , Therefore, you need to replace some code in the startup file with the following code ;

However, copying files downloaded from the punctual atomic link does not need to be modified .

9. When you compile the project, you can find that there is a “error” Of ; In fact, just add one main function , And then in “USER” New under the directory main.c file ( It can be any other name );

10. stay “Manage Project” Add “USER”、“SYSTEM” grouping , And then put main.c Add files to “USER” In group ;

11. Find... From the downloaded file “delay”、“sys”、“usart” Three folders , And then put one of them .c Add file to project directory

12. Configure the output options , As shown in the figure below :

Then configure hex The path to the output of the file .

13. And then configure it .c After the document , You also need to configure .h The header file . Enter the macro definition identifier first , According to the used STM32F1 Capacity of model , To enter the relevant macro

Definition , about STM32F103 Series of chips , The setting principle is as follows :

C8T6 choice “STM32F10X_MD“, Then add the path of the header file .

 14. Compilation found that there are still problems , This is because main.c There is no code in file , And then in main.c Write code ;

  Then the compilation succeeded , However, due to different coding types , So the Chinese characters copied directly will be garbled .

【 Learning exchange group :607439754】

【 Network disk data package from your mobile phone , If you need it, you can collect it yourself 】:

Embedded Internet of things 22 individual STM32 project 、 Competition works ,【 Huaqing vision issued the information package 】http://makerschool.mikecrm.com/f4wjYBB

【 Share some tutorial materials below 】:

(stm32 DC motor drive ) 

Infrared flow sensor

Intelligent temperature control small fan

Ultrasonic radar rangefinder

Interrupt and exception handling mechanisms

(stm32 USART Serial port application )

( Timer )

(stm32 Temperature and humidity collection )

原网站

版权声明
本文为[an520_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/201/202207191654028064.html