You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.2 KiB
Plaintext
68 lines
1.2 KiB
Plaintext
19 years ago
|
// Copyright (c) 2001-2004 Rowley Associates Limited.
|
||
|
//
|
||
|
// This file may be distributed under the terms of the License Agreement
|
||
|
// provided with this software.
|
||
|
//
|
||
|
// THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE
|
||
|
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||
|
//
|
||
|
////////////////////////////////////////////////////////////////////////////////
|
||
|
//
|
||
|
// Olimex LPC-P1 LED Example
|
||
|
//
|
||
|
// Description
|
||
|
// -----------
|
||
|
// This example demonstrates writing to the programmable peripheral interface.
|
||
|
//
|
||
|
////////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
#include <targets/LPC210x.h>
|
||
|
|
||
|
#define LED_RED (1<<8)
|
||
|
#define LED_GREEN (1<<10)
|
||
|
#define LED_YELLOW (1<<11)
|
||
|
|
||
|
#define LED1 LED_YELLOW
|
||
|
|
||
|
static void
|
||
|
ledInit()
|
||
|
{
|
||
|
IODIR |= LED1;
|
||
|
IOSET = LED1;
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
ledOn(void)
|
||
|
{
|
||
|
IOCLR = LED1;
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
ledOff(void)
|
||
|
{
|
||
|
IOSET = LED1;
|
||
|
}
|
||
|
|
||
|
void
|
||
|
delay(int d)
|
||
|
{
|
||
|
for(; d; --d);
|
||
|
}
|
||
|
|
||
|
int
|
||
|
main(void)
|
||
|
{
|
||
|
MAMCR = 2;
|
||
|
ledInit();
|
||
|
while (1)
|
||
|
{
|
||
|
ledOn();
|
||
|
delay(100000);
|
||
|
ledOff();
|
||
|
delay(100000);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|