s1_led.c
来自「包含了NXP众多的MCU的例子程序」· C语言 代码 · 共 52 行
C
52 行
// -------------------------------------------------------------------
// -----------------------LPC2106 LED routines------------------------
// -------------------------------------------------------------------
// Written for TinyARM MB40 development board
// -------------------------------------------------------------------
// THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// -------------------------------------------------------------------
#include "usercode.h" /* Usercode macros (see <template.h>) */
#include "ma_tgt.h" /* Target specific header file */
#include "ma_sfr.h" /* Special function register bitfield macros */
#include "iolpc210x.h" /* Defines Special function registers */
#include "S1_Led.h"
#define TIME_DELAY_VALUE 10000
void Send_To_4Leds(unsigned char Var8)
{
// Selected bits to logic low
IOCLR = 0xF0000000;
// Selected bits to logic high
IOSET = ((unsigned long)Var8) << 28;
}
void Exec_BlinkLed(void)
{
U8 i;
unsigned long Var32;
Var32=TIME_DELAY_VALUE;
i=0;
Send_To_4Leds(i);
i=1;
for (;;)
{
Var32--;
if (!Var32)
{
Send_To_4Leds(i);
Var32=TIME_DELAY_VALUE;
i<<=1;
if (i>8) i=1;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?