ledblinkymain.c

来自「深圳英蓓特公司LPC23XX开发板配套光盘示例程序。」· C语言 代码 · 共 63 行

C
63
字号
 
#include <LPC23xx.H>                    /* LPC23xx definitions               */

#define LED_A      0x01
#define LED_B      0x02
#define LED_C      0x04
#define LED_D      0x08
#define LED_E      0x10
#define LED_F      0x20
#define LED_G      0x40
#define LED_H      0x80


int main (void) 
{
  void delay();
  FIO2DIR  = 0x000000FF;                 /* P2.0..7 defined as Outputs       */
  FIO2MASK = 0x00000000;
  FIO2PIN  = 0x00000000;
  PINSEL10 = 0;
  for(;;)
{
  FIO2SET = LED_A;
  delay();
  FIO2CLR = LED_A;
  delay();
  FIO2SET = LED_B;
  delay();
  FIO2CLR = LED_B;
  delay();
  FIO2SET = LED_C;
  delay();
  FIO2CLR = LED_C;
  delay();
  FIO2SET = LED_D;
  delay();
  FIO2CLR = LED_D;
  delay();
  FIO2SET = LED_E;
  delay();
  FIO2CLR = LED_E;
  delay();
  FIO2SET = LED_F;
  delay();
  FIO2CLR = LED_F;
  delay();
  FIO2SET = LED_G;
  delay();
  FIO2CLR = LED_G;
  delay();
  FIO2SET = LED_H;
  delay();
  FIO2CLR = LED_H;
  delay();
}  
}

void delay()
{
int i;
for(i=0;i<1000000;i++);	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?