LCD 16x2 Interfacing With ARM MBED

Overview of LCD 16x2

LCD 16x2

 

  • LCDs (Liquid Crystal Displays) are used in embedded system applications for displaying various parameters and status of the system.
  • LCD 16x2 is a 16-pin device that has 2 rows that can accommodate 16 characters each.
  • LCD 16x2 can be used in 4-bit mode or 8-bit mode.
  • It is also possible to create custom characters.
  • It has 8 data lines and 3 control lines that can be used for control purposes.

For more information about LCD 16x2 and how to use it, refer the topic LCD 16x2 module in the sensors and modules section.

 

Connection Diagram of LCD16x2 with ARM MBED (LPC1768)

Interfacing 16x2 LCD With ARM MBED

 

 

Print Hello World on LCD16x2 using LPC1768 ARM MBED

Displaying text “Hello World!\n” on 16x2 LCD in 4-bit mode.

Here, we are using the TextLCD library, developed by Simon Ford for controlling various LCD panels based on the HD44780 4-bit interface.

You can find more information about the TextLCD library from here.

 

LCD16x2 Code for LPC1768 ARM MBED

#include "mbed.h"
#include "TextLCD.h"

TextLCD lcd(p5, p6, p7, p8, p9, p10);//RS, RW, D4, D5, D6, D7

int main() {
    int a=0;
    lcd.printf("Hello World!\n");
    
    while(1)
    { 
        lcd.locate(0,1);       
        lcd.printf("%d",a);
        wait(1);
        a++;
    }        
}

Components Used

ARM mbed 1768 LPC1768 Board
ARM mbed 1768 Board
1
LCD16x2 Display
LCD16x2 Display
1

Downloads

LCD_16x2_mbed_uvision5_lpc1768 Download
Ad