Example of using a Text LCD with the LPC4088 Experiment Base Board

Dependencies:   TextLCD mbed

Committer:
embeddedartists
Date:
Wed Oct 01 11:18:36 2014 +0000
Revision:
0:e11079722007
First version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 0:e11079722007 1 /******************************************************************************
embeddedartists 0:e11079722007 2 * Includes
embeddedartists 0:e11079722007 3 *****************************************************************************/
embeddedartists 0:e11079722007 4 #include "mbed.h"
embeddedartists 0:e11079722007 5 #include "TextLCD.h"
embeddedartists 0:e11079722007 6
embeddedartists 0:e11079722007 7 /******************************************************************************
embeddedartists 0:e11079722007 8 * Typedefs and defines
embeddedartists 0:e11079722007 9 *****************************************************************************/
embeddedartists 0:e11079722007 10
embeddedartists 0:e11079722007 11 /******************************************************************************
embeddedartists 0:e11079722007 12 * Local variables
embeddedartists 0:e11079722007 13 *****************************************************************************/
embeddedartists 0:e11079722007 14
embeddedartists 0:e11079722007 15 DigitalOut myled(LED1);
embeddedartists 0:e11079722007 16
embeddedartists 0:e11079722007 17 SPI spi_lcd(p5, p6, p7); // MOSI, MISO, SCLK
embeddedartists 0:e11079722007 18
embeddedartists 0:e11079722007 19 /******************************************************************************
embeddedartists 0:e11079722007 20 * Local functions
embeddedartists 0:e11079722007 21 *****************************************************************************/
embeddedartists 0:e11079722007 22
embeddedartists 0:e11079722007 23 /*
embeddedartists 0:e11079722007 24 Hardware Setup:
embeddedartists 0:e11079722007 25
embeddedartists 0:e11079722007 26 - Jumpers JP1..JP6 should be in position 1-2
embeddedartists 0:e11079722007 27 - Jumpers in J14 should NOT be inserted
embeddedartists 0:e11079722007 28 - Jumper J7 should be inserted
embeddedartists 0:e11079722007 29 - Display in connector J10. Display should be over the base board - not outside
embeddedartists 0:e11079722007 30 */
embeddedartists 0:e11079722007 31
embeddedartists 0:e11079722007 32 int main() {
embeddedartists 0:e11079722007 33 TextLCD_SPI lcd(&spi_lcd, p30, TextLCD::LCD16x2); // SPI bus, CS pin, LCD Type ok
embeddedartists 0:e11079722007 34
embeddedartists 0:e11079722007 35 lcd.cls();
embeddedartists 0:e11079722007 36 lcd.locate(0, 0);
embeddedartists 0:e11079722007 37 lcd.putc('E');
embeddedartists 0:e11079722007 38 lcd.putc('m');
embeddedartists 0:e11079722007 39 lcd.putc('b');
embeddedartists 0:e11079722007 40 lcd.putc('e');
embeddedartists 0:e11079722007 41 lcd.putc('d');
embeddedartists 0:e11079722007 42 lcd.putc('d');
embeddedartists 0:e11079722007 43 lcd.putc('e');
embeddedartists 0:e11079722007 44 lcd.putc('d');
embeddedartists 0:e11079722007 45 lcd.putc(' ');
embeddedartists 0:e11079722007 46 lcd.putc('A');
embeddedartists 0:e11079722007 47 lcd.putc('r');
embeddedartists 0:e11079722007 48 lcd.putc('t');
embeddedartists 0:e11079722007 49 lcd.putc('i');
embeddedartists 0:e11079722007 50 lcd.putc('s');
embeddedartists 0:e11079722007 51 lcd.putc('t');
embeddedartists 0:e11079722007 52 lcd.putc('s');
embeddedartists 0:e11079722007 53 lcd.putc('!');
embeddedartists 0:e11079722007 54 lcd.setCursor(TextLCD::CurOff_BlkOn);
embeddedartists 0:e11079722007 55
embeddedartists 0:e11079722007 56 while(1) {
embeddedartists 0:e11079722007 57 myled = 1;
embeddedartists 0:e11079722007 58 wait(0.2);
embeddedartists 0:e11079722007 59 myled = 0;
embeddedartists 0:e11079722007 60 wait(0.2);
embeddedartists 0:e11079722007 61 }
embeddedartists 0:e11079722007 62 }