Hello world for lpclcd module https://strawberry-linux.com/catalog/items?code=12014

Dependencies:   I2cLCD mbed

Program "lpclcd" sample via USB Bootloader using offline uVision toolchain(MDK)

NXP USB Bootloader needs checksum. if you use MDK, needs extra command to create checksum before create .bin file.

You must add project option's "Run User Program After build" section,

 $K\ARM\BIN\ELFDWT.EXE !L

/media/uploads/mio/calcchecksum.png

see http://www.keil.com/support/docs/3592.htm and http://www.keil.com/support/man/docs/uv4/uv4_ut_elfdwt.htm

If you create .bin on mbed online compiler, or program via JTAG(SWD), this process(option) is not needed.

Committer:
mio
Date:
Sun Jun 09 11:02:11 2013 +0000
Revision:
0:14cf7caedfb4
hello world for lpclcd

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mio 0:14cf7caedfb4 1 //
mio 0:14cf7caedfb4 2 // for strawberry-linux.com's "lpclcd" 11U24 Board
mio 0:14cf7caedfb4 3 // https://strawberry-linux.com/catalog/items?code=12014
mio 0:14cf7caedfb4 4 //
mio 0:14cf7caedfb4 5 #include "mbed.h"
mio 0:14cf7caedfb4 6 #include "I2cLCD.h"
mio 0:14cf7caedfb4 7
mio 0:14cf7caedfb4 8 // SW,LED,PULLUP
mio 0:14cf7caedfb4 9 // P0_1 : USER SW (ISP)
mio 0:14cf7caedfb4 10 // P0_6 : LED
mio 0:14cf7caedfb4 11 // P0_23 : I2C PULLUP
mio 0:14cf7caedfb4 12
mio 0:14cf7caedfb4 13 //
mio 0:14cf7caedfb4 14 // I2C LCD SlaveAddress = 0x7c
mio 0:14cf7caedfb4 15 // SlaveAddress , commands and the initialize sequence are almost
mio 0:14cf7caedfb4 16 // same as "i2c low voltage lcd module" by strawberry-linux.
mio 0:14cf7caedfb4 17 // (http://strawberry-linux.com/catalog/items?code=27001)
mio 0:14cf7caedfb4 18 //
mio 0:14cf7caedfb4 19 // So I2cLCD library seems to work well.
mio 0:14cf7caedfb4 20 //
mio 0:14cf7caedfb4 21 // P0_25 : RESET
mio 0:14cf7caedfb4 22 // P0_4 : SCL
mio 0:14cf7caedfb4 23 // P0_5 : SDA
mio 0:14cf7caedfb4 24 // P1_3 : LCD BACKLIGHT
mio 0:14cf7caedfb4 25 //
mio 0:14cf7caedfb4 26
mio 0:14cf7caedfb4 27 DigitalIn sw(P0_1);
mio 0:14cf7caedfb4 28 DigitalOut backlight(P1_3);
mio 0:14cf7caedfb4 29 DigitalOut led(P1_6); // The manual says "P0_6" but schematic is "P1_6"
mio 0:14cf7caedfb4 30 I2cLCD lcd(P0_5, P0_4,P0_25);
mio 0:14cf7caedfb4 31 Ticker timer;
mio 0:14cf7caedfb4 32
mio 0:14cf7caedfb4 33 int count = 0 ;
mio 0:14cf7caedfb4 34
mio 0:14cf7caedfb4 35 void attime()
mio 0:14cf7caedfb4 36 {
mio 0:14cf7caedfb4 37 lcd.locate(0,0);
mio 0:14cf7caedfb4 38 lcd.printf("Hello World! %d\r\n",count);
mio 0:14cf7caedfb4 39 led = !led;
mio 0:14cf7caedfb4 40 count++ ;
mio 0:14cf7caedfb4 41 }
mio 0:14cf7caedfb4 42
mio 0:14cf7caedfb4 43 int main()
mio 0:14cf7caedfb4 44 {
mio 0:14cf7caedfb4 45 backlight = 0;
mio 0:14cf7caedfb4 46 timer.attach(&attime, 1);
mio 0:14cf7caedfb4 47 while(1)
mio 0:14cf7caedfb4 48 {
mio 0:14cf7caedfb4 49 }
mio 0:14cf7caedfb4 50 }