Blinker for LPC17xx

Download pre-release library modules and new examples to use with Astrobe for Cortex-M3. Forum members can also upload their own source code examples.

Blinker for LPC17xx

Postby cfbsoftware » Thu Apr 05, 2012 11:24 pm

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);
...
cfbsoftware
Site Admin
 
Posts: 332
Joined: Fri Dec 31, 2010 12:30 pm

Return to Cortex-M3

cron