• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeArduinoRun Serial UART 16×2 LCD on Arduino
Previous Next

Run Serial UART 16×2 LCD on Arduino

Posted by: admin , March 6, 2014

[vc_row][vc_column][vc_column_text]Serial_arduino_16x2_00

The serial UART 16×2 LCD allows you to control a parallel based LCD over a single-wire serial interface. The serial LCD takes care of all the HD44780 commands allowing seamless integration with any micro that can communicate over a wide range of TTL serial baud rates. The

Communication with Serial 16×2 LCD requires 5V TTL serial at a default baud rate of 9600bps (8-N-1). You can adjust the baud to any standard rate between 2400 and 38400bps. The power, ground and RX pins are all broken out to a 4-pin 2.54mm pitch header.

Serial 16×2 LCD has the ability to dim the backlight to conserve power if needed. There is also a potentiometer on the backpack to adjust the contrast.[/vc_column_text][vc_tour][vc_tab title=”Part list” tab_id=”1393980378-1-10″][vc_column_text]1  x  arduino uno

1  x  Serial UART 16×2 LCD

Several  dupont line[/vc_column_text][/vc_tab][vc_tab title=”Wiring Diagram” tab_id=”1393980378-2-100″][vc_column_text]Serial UART 16×2 LCD   GND  – >Arduino   GND

Serial UART 16×2 LCD   5V   – > Arduino   +5V

Serial UART 16×2 LCD   Rx pin – > Arduino  D3  pin[/vc_column_text][/vc_tab][vc_tab title=”Test code” tab_id=”1394038777636-2-5″][vc_column_text]

#include <SoftwareSerial.h>

#define txPin 2

SoftwareSerial LCD = SoftwareSerial(0, txPin);
// since the LCD does not send data back to the Arduino, we should only define the txPin
const int LCDdelay=10;  // conservative, 2 actually works

// wbp: goto with row & column
void lcdPosition(int row, int col) {
  LCD.write(0xFE);   //command flag
  LCD.write((col + row*64 + 128));    //position 
  delay(LCDdelay);
}
void clearLCD(){
  LCD.write(0xFE);   //command flag
  LCD.write(0x01);   //clear command.
  delay(LCDdelay);
}
void backlightOn() {  //turns on the backlight
  LCD.write(0x7C);   //command flag for backlight stuff
  LCD.write(157);    //light level.
  delay(LCDdelay);
}
void backlightOff(){  //turns off the backlight
  LCD.write(0x7C);   //command flag for backlight stuff
  LCD.write(128);     //light level for off.
   delay(LCDdelay);
}
void serCommand(){   //a general function to call the command flag for issuing all other commands   
  LCD.write(0xFE);
}

void setup()
{
  pinMode(txPin, OUTPUT);
  LCD.begin(9600);
  backlightOn() ;
  clearLCD();
  lcdPosition(0,0);
  LCD.print("Hello world from LinkSprite!");
}

void loop()
{
}

[/vc_column_text][/vc_tab][vc_tab title=”Test result” tab_id=”1394038778595-3-3″][vc_column_text]Serial_arduino_16x2

Serial UART 16×2 LCD will show :Hello World from LinkSprite。[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Tags: Arduino

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors