My first demo, with USART0 (P04/P00 as TX/RX) and LED toggle, working on my LPC812MiniKit. Built with mBed, converted by Bitware bin2hex, programmed by FlashMagic. Released to public as a baseline for new application.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002 *   LPC812HandsOn
00003 *   Allan K Liu
00004 *   2013-11-27
00005 *
00006 *   Works on LPC812MAX (with hardware modification), LPC812MiniKit
00007 *   
00008 *   LPC812MAX/mBed
00009 *   Direct download, change SJ1/SJ4
00010 *
00011 *   LPC812MiniKit
00012 *   P04/P00 as TX/RX, as same as bootloader does, Use Flash Magic to download.
00013 *   Before download, use BIN2HEX (from Keil) to convert binary to hex format
00014 *   You may rename your *.bin to standard DOS 8+3 file name format before bin2hex.
00015 *   
00016 *   mBed/LPC812MAX uses IRC 12MHz, PLL to 24MHz
00017 *   LPC812MiniKit uses external 12MHz, PLL to 24MHz
00018 *
00019 *   So code built for MAX can run in MiniKit.
00020 */
00021 #include "mbed.h"
00022 #include "Serial.h"
00023 
00024 DigitalOut myled1(LED1);
00025 DigitalOut myled2(LED2);
00026 
00027 Serial pc(P0_4, P0_0); // tx, rx
00028 
00029 void setup(){
00030     pc.baud(57600);
00031     pc.printf("\r\nLPC812 Mini-Kit\r\n");
00032 }
00033 
00034 void loop(){
00035     while(1) {
00036         myled1 = 1;
00037         wait(0.2);
00038         myled1 = 0;
00039         wait(0.2);
00040     }
00041 }
00042 
00043 int main() {
00044     setup();
00045     loop();
00046 }
00047