| 引入相关芯片的头文件 |
\*----------------------------------------------------------*/
#include <LPC11xx.h> /* LPC11xx Peripheral Registers */
#include "system_LPC11xx.h"
/*----------------------------------------------------------*\
| HARDWARE DEFINE |
\*----------------------------------------------------------*/
#define LED (1<<5) /* LED D1 connect to PIO3_5 */
/*----------------------------------------------------------*\
| Delay 延时 Inserts a delay time. |
| nCount: 延时时间 specifies the delay time length. |
\*----------------------------------------------------------*/
void Delay(unsigned nCount) {
for(; nCount != 0; nCount--);
}
/*----------------------------------------------------------*\
| MIAN ENTRY |
\*----------------------------------------------------------*/
int main() {
SystemInit();
/* Enable AHB clock to the GPIO domain. */
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);
LPC_GPIO3->DIR |= LED; // pin output
for(;;) {
LPC_GPIO3->DATA &= ~LED; // reset pin : LED light
Delay(2000000);
LPC_GPIO3->DATA |= LED; // set pin: LED off
Delay(2000000);
}
}
/*--------------------- END OF FILE ----------------------*\
| COPYRIGHT |
| 智林测控技术研究所 ZERO Research Institute |
| www.the0.net |
\*----------------------------------------------------------*/
为方便大家看我打个包 |