Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4272808
  • 博文数量: 1148
  • 博客积分: 25453
  • 博客等级: 上将
  • 技术积分: 11949
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-06 21:14
文章分类

全部博文(1148)

文章存档

2012年(15)

2011年(1078)

2010年(58)

分类: 嵌入式

2011-06-10 14:19:50

目的: 熟悉STM32在Keil下的开发过程,使用jlink

工程建立过程参考资料: 如何使用MDK.rar  
有个不同的地方: 就是在 TARGETS 设置 debug 的时候有个区别:
设置为  RDI interface device 因为我们使用 JLINK 下载

注意库的加载在  C:\Keil\ARM\RV31\LIB\ST\STM32F10x

然后设置 JLINK 选项 参考 : JLINK V8用户手册中文版.part3.rar    JLINK V8用户手册中文版.part1.rar    JLINK V8用户手册中文版.part2.rar  

整个工程的代码: test.rar  

主函数代码:

LED2 - PD2
LED0 - PA8
  1. #include "stm32f10x_lib.h"

  2. GPIO_InitTypeDef GPIO_InitStructure;

  3. void LED_Init(void)
  4. {
  5.     RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD,ENABLE);
  6.         
  7.     GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;// | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 ;
  8.     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  9.     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  10.     GPIO_Init(GPIOD, &GPIO_InitStructure);
  11. }

  12. void LED_TureOn(u8 led)
  13. {

  14. }

  15. void Delay(vu32 nCount)
  16. {
  17.     for(; nCount != 0; nCount--);
  18. }

  19. int main()
  20. {
  21.     LED_Init();

  22.     while(1)
  23.     {
  24.         GPIO_SetBits(GPIOD, GPIO_Pin_2);
  25.         Delay(0x8ffff);
  26.         GPIO_ResetBits(GPIOD, GPIO_Pin_2);
  27.         Delay(0x8ffff);
  28.     }
  29.     return 0;
  30. }

阅读(1360) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~