keil配置工程文件

 

1、新建工程:liubo.uvproj

 

2、建立目录:

     工程目录下建立文件夹: USR,  Readme

     库函数中加入文件夹:ASM, System复制进入工程文件夹

     Tartge : STM32

     groups:  ASM , USR, Lib , System, Readme

      

3、设置

     (1) Device:STM32F103VE

     (2) Target: 选择晶振

     (3) Output: 生成hex

     (4) C/C++:    Define: USE_STDPERIPH_DRIVER,STM32F10X_HD

                          IncludePaths: \lib\inc,  \System,  \USR

     (5) Debug: use: J-LINK/J-Trace Cortex

                      Debug  ----  Settings :  ort: JTAG  2MHZ

                      Flash Download ---- Erase Full C , 勾选Program , Verify, Reset and Run

                                                    Add: STM32F10X  High-density

     (6) Utilities:  Use Target Driver for Flash Programming: J-LINK/J-Trace Cortex

 

4、groups添加文件:

    ASM中添加startup_stm32f10x_hd.s

    Lib中添加stm32f10x_rcc.c ,  stm32f10x_gpio.c 等需要的库

    System中添加system_stm32f10x.c,  core_cm3.c 文件

   

5、新建pbdata.c 添加到USR,保存在USR文件夹

    新建pbdata.h保存在USR文件夹

    pbdata.h中定义示例如下:    

 1 #ifndef _pbdata_H
 2 #define _pbdata_H
 3 
 4 #include"stm32f10x.h"
 5 
 6 /*定义变量*/
 7 extern u8 dt;
 8 
 9 /*定义函数*/
10 void delay(u32 nCount);
11 
12 #endif
View Code

    pbdata.c中定义示例:

1 #include"pbdata.h"
2 
3 
4 u8 dt=0;
5 
6 void delay(u32 nCount)
7 {
8   for(;nCount!=0;nCount--);
9 }
View Code

   主函数定义示例:

1 #include"stm32f10x.h"
2 #include"pbdata.h"
3 
4 int main(void)
5 {
6     dt=123;
7     delay(100);
8 }
View Code


6、  每个代码文件最后必须回车,否则报错

 

7、配置好的工程:http://download.csdn.net/detail/a1181803348/8733491

 

posted @ 2015-05-24 14:48  如风轻逸  阅读(1460)  评论(0编辑  收藏  举报