The delaySecond() and delayTenthSecond() are coarse but OK for my basic testing.
.END
// ****************************************************************************
// Program - Blink LED
// Description - Blink LED
// Author - TL Fong
// Version - 0.34
// Date - 2013jul10hkt1553
// License - Free
// Hardware - Somy ARM Cortex M0 LPC1114 Learning Board
// Software - Keil uVision 4.71.2.0 ARM compiler toolchain
// Hardware configuration notes
// 1. LED1 is connected to PIO1-8
// ****************************************************************************
#include <stdio.h>
#include "LPC11xx.h"
void setPort1Pin8ToOutput() // PIO1_8 for LED1 pin set to output
{
LPC_GPIO1->DIR |= (1 << 8);
}
void setPort1Pin8Low() // PIO1_8 set Low to turn on LED1
{
LPC_GPIO1->DATA &= ~(1 << 8);
}
void setPort1Pin8High() // PIO1_8 set High to turn on LED1
{
LPC_GPIO1->DATA |= (1 << 8);
}
void delaySecond(int count)
{
int i, j, k;
for (i = 0; i < count; i++)
{
for (j = 0; j < 0x3F; j++)
{
for (k = 0; k < 0x000CBFF; k++)
{
}
}
}
}
void delayTenthSecond(int count)
{
int i, j, k;
for (i = 0; i < count; i++)
{
for (j = 0; j < 0x4; j++)
{
for (k = 0; k < 0x000BB00; k++)
{
}
}
}
}
int main()
{
setPort1Pin8ToOutput(); // PIO1_8 for LED1 pin set to output
while (1)
{
setPort1Pin8Low(); // Turn on LED
delayTenthSecond(10);
setPort1Pin8High(); // Turn off LED
delayTenthSecond(10);
}
}
// ****************************************************************************
// End of Program
// ****************************************************************************
No comments:
Post a Comment