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

Committer:
allankliu
Date:
Tue Nov 26 23:54:04 2013 +0000
Revision:
0:76559a0890ff
My first working demo for LED/USART, built with mBed online toolchain, verified on LPC812MiniKit, conversion with bin2hex, programmed with FlashMagics. Uses P04/P00 as TX/RX, IRC 12MHz.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
allankliu 0:76559a0890ff 1 /*
allankliu 0:76559a0890ff 2 * LPC812HandsOn
allankliu 0:76559a0890ff 3 * Allan K Liu
allankliu 0:76559a0890ff 4 * 2013-11-27
allankliu 0:76559a0890ff 5 *
allankliu 0:76559a0890ff 6 * Works on LPC812MAX (with hardware modification), LPC812MiniKit
allankliu 0:76559a0890ff 7 *
allankliu 0:76559a0890ff 8 * LPC812MAX/mBed
allankliu 0:76559a0890ff 9 * Direct download, change SJ1/SJ4
allankliu 0:76559a0890ff 10 *
allankliu 0:76559a0890ff 11 * LPC812MiniKit
allankliu 0:76559a0890ff 12 * P04/P00 as TX/RX, as same as bootloader does, Use Flash Magic to download.
allankliu 0:76559a0890ff 13 * Before download, use BIN2HEX (from Keil) to convert binary to hex format
allankliu 0:76559a0890ff 14 * You may rename your *.bin to standard DOS 8+3 file name format before bin2hex.
allankliu 0:76559a0890ff 15 *
allankliu 0:76559a0890ff 16 * mBed/LPC812MAX uses IRC 12MHz, PLL to 24MHz
allankliu 0:76559a0890ff 17 * LPC812MiniKit uses external 12MHz, PLL to 24MHz
allankliu 0:76559a0890ff 18 *
allankliu 0:76559a0890ff 19 * So code built for MAX can run in MiniKit.
allankliu 0:76559a0890ff 20 */
allankliu 0:76559a0890ff 21 #include "mbed.h"
allankliu 0:76559a0890ff 22 #include "Serial.h"
allankliu 0:76559a0890ff 23
allankliu 0:76559a0890ff 24 DigitalOut myled1(LED1);
allankliu 0:76559a0890ff 25 DigitalOut myled2(LED2);
allankliu 0:76559a0890ff 26
allankliu 0:76559a0890ff 27 Serial pc(P0_4, P0_0); // tx, rx
allankliu 0:76559a0890ff 28
allankliu 0:76559a0890ff 29 void setup(){
allankliu 0:76559a0890ff 30 pc.baud(57600);
allankliu 0:76559a0890ff 31 pc.printf("\r\nLPC812 Mini-Kit\r\n");
allankliu 0:76559a0890ff 32 }
allankliu 0:76559a0890ff 33
allankliu 0:76559a0890ff 34 void loop(){
allankliu 0:76559a0890ff 35 while(1) {
allankliu 0:76559a0890ff 36 myled1 = 1;
allankliu 0:76559a0890ff 37 wait(0.2);
allankliu 0:76559a0890ff 38 myled1 = 0;
allankliu 0:76559a0890ff 39 wait(0.2);
allankliu 0:76559a0890ff 40 }
allankliu 0:76559a0890ff 41 }
allankliu 0:76559a0890ff 42
allankliu 0:76559a0890ff 43 int main() {
allankliu 0:76559a0890ff 44 setup();
allankliu 0:76559a0890ff 45 loop();
allankliu 0:76559a0890ff 46 }
allankliu 0:76559a0890ff 47