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.
Revision 0:76559a0890ff, committed 2013-11-26
- Comitter:
- allankliu
- Date:
- Tue Nov 26 23:54:04 2013 +0000
- Commit message:
- 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.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 76559a0890ff main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 26 23:54:04 2013 +0000 @@ -0,0 +1,47 @@ +/* +* LPC812HandsOn +* Allan K Liu +* 2013-11-27 +* +* Works on LPC812MAX (with hardware modification), LPC812MiniKit +* +* LPC812MAX/mBed +* Direct download, change SJ1/SJ4 +* +* LPC812MiniKit +* P04/P00 as TX/RX, as same as bootloader does, Use Flash Magic to download. +* Before download, use BIN2HEX (from Keil) to convert binary to hex format +* You may rename your *.bin to standard DOS 8+3 file name format before bin2hex. +* +* mBed/LPC812MAX uses IRC 12MHz, PLL to 24MHz +* LPC812MiniKit uses external 12MHz, PLL to 24MHz +* +* So code built for MAX can run in MiniKit. +*/ +#include "mbed.h" +#include "Serial.h" + +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); + +Serial pc(P0_4, P0_0); // tx, rx + +void setup(){ + pc.baud(57600); + pc.printf("\r\nLPC812 Mini-Kit\r\n"); +} + +void loop(){ + while(1) { + myled1 = 1; + wait(0.2); + myled1 = 0; + wait(0.2); + } +} + +int main() { + setup(); + loop(); +} +
diff -r 000000000000 -r 76559a0890ff mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Nov 26 23:54:04 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file