Page 1 of 1

Blinker for LPC17xx

Posted: Thu Apr 05, 2012 11:24 pm
by cfbsoftware
The following example works on the LPC1751 and LPC1756 boards from Coridium.

Code: Select all

MODULE Blinker;
(* 
     Example Cortex-M3 Oberon Program for NXP LPC17xx  
     Led connected to P2.10 blinking approx. once per second
*)

IMPORT Main, MCU, SYSTEM, Timer;

PROCEDURE Run();
CONST
  (* led connected to pin P2.10 *)
  ledBit = {10};
VAR
  direction: SET;
BEGIN
  (* Set led pin as output by setting the direction bit *)
  SYSTEM.GET(MCU.FIO2DIR, direction);
  SYSTEM.PUT(MCU.FIO2DIR, direction + ledBit);
  
  WHILE TRUE DO
    SYSTEM.PUT(MCU.FIO2CLR, ledBit);
    Timer.MSecDelay(500);
    SYSTEM.PUT(MCU.FIO2SET, ledBit);
    Timer.MSecDelay(500)
  END
END Run;

BEGIN
  Run()
END Blinker.
The LPCXpresso LPC1769 board has an LED connected to P0.22.

Just change the definition of ledBit and all the FIO2... references to FIO0... e.g.

Code: Select all

ledBit = {22};
...
  SYSTEM.PUT(MCU.FIO0DIR, direction + ledBit);
...