main.c
来自「基于LPC2148的GPIO简单的Keil程序」· C语言 代码 · 共 45 行
C
45 行
#include <LPC214X.H>
typedef unsigned int uint32;
typedef unsigned char uchar;
void setspeed(uchar M,uchar P)
{
PLL0CON=1;
PLL0CFG=(P<<5) | M;
PLL0FEED=0xAA;
PLL0FEED=0x55;
while(!(PLL0STAT &(1<<10)));
PLL0CON=3;
PLL0FEED=0xAA;
PLL0FEED=0x55;
}
void delay()
{
unsigned int i;
for(i=0;i<1000;i++)
{
;
}
}
int main()
{
uint32 tmp;
setspeed(1,3);
PINSEL1=PINSEL1 & 0xfffff3fc;
tmp = IODIR0;
tmp = tmp | 0x00210000;;
IODIR0 =tmp;
for(;;)
{
IOSET0=IOPIN0 | 0x00210000;
delay();
IOCLR0=IOPIN0 | 0x00210000;
delay();
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?