5 years, 10 months ago.

Serial & LCD

Hi Friends, iam new to this platform .can any help me out how to configure the UART such that the data entering in the terminal has to be visible in 16*2 display. iam using LPC1768 board

1 Answer

5 years, 10 months ago.

Hi, you can try some like this...

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

Serial pc(USBTX, USBRX);
TextLCD lcd(PA_10, PB_3, PB_5, PB_4, PB_10, PA_8); // rs, e, d4-d7 
DigitalOut myled(LED1); 


int main()
{
    char str [32]; // small array
     
     lcd.cls();
     lcd.setAddress(0,0);
     lcd.printf("Hello World!\nSerial to LCD");
    
    while(1){
            pc.scanf("%s", str); //fill data to array from UART
            lcd.cls(); // clean display and return home position column 0 and row 0
            myled =! myled; //no blink no fun
            lcd.printf("%s", str); //put data from array to display
    }
}

You did not specify what display you have. I suppose it is 16 * 2 with parallel communication.