So I am trying the header thing.  I moved the delay functions from main.c to a newly created header file called timer.h which is now included in the new main.c with timer functions removed.

I built and ran the program and to my surprise, everything works OK.

Lunch time.

.END

// ****************************************************************************
// Program - Blink LED
// Description - Blink LED
// Author - TL Fong
// Version - 0.35
// Date - 2013jul11hkt0954
// License - Free
// Hardware - Somy ARM Cortex M0 LPC1114/301 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"
#include "timer.h"

void setPort1Pin8ToOutput() // PIO1_8 for LED1 set to output
  {
  LPC_GPIO1->DIR |= (1 << 8);
  }

void setPort1Pin8Low() // PIO1_8 Low = LED1 on
  {
  LPC_GPIO1->DATA &= ~(1 << 8);
  }

void setPort1Pin8High() // PIO1_8 High = LED1 off
  {  
  LPC_GPIO1->DATA |= (1 << 8);
  }


int main()
  {
  setPort1Pin8ToOutput(); // PIO1_8 for LED1 pin set to output
  while (1)
 {  
 setPort1Pin8Low(); // LED on
    delayTenthSecond(5);
    setPort1Pin8High(); // LED off
    delaySecond(1);
    }
  }

// ****************************************************************************
// End of Program
// ****************************************************************************

.END2


No comments:

Post a Comment