⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blinky.c

📁 基于LPC2292的发声程序
💻 C
字号:
/******************************************************************************/
/* BLINKY.C: LED Flasher                                                      */
/******************************************************************************/
/* This file is part of the uVision/ARM development tools.                    */
/* Copyright (c) 2005-2006 Keil Software. All rights reserved.                */
/* This software may only be used under the terms of a valid, current,        */
/* end user licence from KEIL for a compatible version of KEIL software       */
/* development tools. Nothing else gives you the right to use this software.  */
/******************************************************************************/

#include <LPC22XX.H>                        /* LPC22XX Peripheral Registers */

extern long volatile timeval;
extern void init_timer(void);

void wait (void)  {                         /* wait function */
  unsigned long i;

  i = timeval;
  while ((timeval - i) != 10);              /* wait 100ms */
}

int main (void)  {

  init_timer();                             /* Initialize Timer */

  IODIR0 = 0x00000080;                      /* P0.8 defined as Output */

  while (1) {                               /* Loop forever */
    IOCLR0 = 0x00000080;                    /* Turn LED On  (P0.8 = 0) */
    wait();                                 /* Wait */
    IOSET0 = 0x00000080;                    /* Turn LED Off (P0.8 = 1) */
    wait();                                 /* Wait */
  }
}

⌨️ 快捷键说明

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