ledcon.c
来自「LED blink for lpc2114」· C语言 代码 · 共 49 行
C
49 行
/**********************************************************************
** Program Name : LED BLINK **
** Compiler : Keil **
** Board : MiniARM **
** Firm : UC Micro Systems **
** Website : www.ucmicrosys.com **
** **
** Description : This program blinks LED4 connected to P0.25 **
** Connect LED power jumper before running this **
** program. **
** **
*********************************************************************/
#include "lpc21xx.h"
#define LEDCON 0x02000000 /* P0.25 */
/****************************************************************************
* DelayNS()
****************************************************************************/
void DelayNS(unsigned int dly)
{ unsigned int i;
for(; dly>0; dly--)
for(i=0; i<50000; i++);
}
/****************************************************************************
*main()
****************************************************************************/
int main(void)
{ PINSEL0 = 0x00000000; // Enable GPIO
PINSEL1 = 0x00000000;
IO0DIR = LEDCON; // Enable LED4 Direction
while(1)
{ IO0SET = LEDCON;
DelayNS(30);
IO0CLR = LEDCON;
DelayNS(30);
}
return(0);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?