码迷,mamicode.com
首页 > 其他好文 > 详细

1、第一个程序控制LED(包括如何烧写程序)

时间:2015-08-11 06:55:08      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:

 

 

C:\Keil-ARM\ARM\Device\Nordic\nrf51822\Board\pca10001

第一个程序控制LED

C:\Keil-ARM\ARM\Device\Nordic\nrf51822\Board\pca10001\blinky_example

技术分享

32页介绍如何烧写程序

只要连接一个mini USB就可以进行烧写(要使用:

技术分享

操作步骤:
1. 如6.1.1节所述 选择要进行操作的目标板然后选择Program Application.
2. 单击Browse 定位应用程序HEX文件的位置,并选中它。
3. 确定是否勾选回读保护。 假如勾选回读保护 ,下次烧录程序前必须要把芯片全部擦除。

 1 #include <stdbool.h>
 2 #include <stdint.h>
 3 #include "nrf_delay.h"
 4 #include "nrf_gpio.h"
 5 #include "boards.h"
 6 
 7 /**
 8  * @brief Function for application main entry.
 9  */
10 int main(void)
11 {
12   // Configure LED-pins as outputs
13   nrf_gpio_cfg_output(LED_0);//[为设置引脚为输出模式,其中LED_0采用宏定义]
14   nrf_gpio_cfg_output(LED_1);
15   
16   // LED 0 and LED 1 blink alternately.
17   while(true)
18   {
19     nrf_gpio_pin_clear(LED_0);
20     nrf_gpio_pin_set(LED_1);
21     
22     nrf_delay_ms(500);
23     
24     nrf_gpio_pin_clear(LED_1);//[设置引脚高低电平]
25     nrf_gpio_pin_set(LED_0);
26     
27     nrf_delay_ms(500);
28   }
29 }

链接:http://pan.baidu.com/s/1kTxlxd1

 

1、第一个程序控制LED(包括如何烧写程序)

标签:

原文地址:http://www.cnblogs.com/happyhappy/p/4719584.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!