Blinky!

Now that we have our project imported, we can get start creating our own projects.

By default, the LPC810_CodeBase you downloaded is setup to run a blinky example on pin 0.2, and it spits out 'Hello, LPC810!' on the default UART pins, which we can see in the 'while(1)' super-loop in main.c, shown below:
Download: file
  while(1)
  {
    #if !defined(USE_SWD)
      /* Turn LED Off by setting the GPIO pin high */
      LPC_GPIO_PORT->SET0 = 1 << LED_LOCATION;
      mrtDelay(500);

      /* Turn LED On by setting the GPIO pin low */
      LPC_GPIO_PORT->CLR0 = 1 << LED_LOCATION;
      mrtDelay(500);
    #else
      /* Just insert a 1 second delay */
      mrtDelay(1000);
    #endif

    /* Send some text (printf is redirected to UART0) */
    printf("Hello, LPC810!\n");
  }
"LPC_GPIO_PORT->CLR0 = 1 << LED_LOCATION" will clear whatever pin is at the 'LED_LOCATION' bit on GPIO bank 0. 'LPC_GPIO_PORT->SET0' does the opposite. This is how you turn the LED on or off, but for those changes to be visible, we need to insert a delay between state changes, which is accomplished with the mrtDelay(500) lines, which causes a 500ms delay.

Blinky is following by our printf() statement, and by default all printf output is redirect to UART0 on the LPC810.

Before worrying about writing and programs, though, lets build the firmware as-is!

Building Firmware in LPCXpresso

To build a project in LPCXpresso (or Eclipse), you need to right-click on the current project in the project explorer (located on the left-hand side of the IDE by default), and select the 'Build Project' menu item.
If everything goes well (and there are no errors in our code), you should get something like this in the output window at the bottom of LPCXpresso to indicate that the build process is complete:
We now have our 'blinky' firmware (located in the same folder as our project files), and can get it onto our LPC810 using the UART bootloader built into the chips ...
This guide was first published on May 24, 2013. It was last updated on May 24, 2013. This page (Blinky!) was last updated on Apr 21, 2019.