Wednesday, June 22, 2022

Arduino and 16x2 Character LCD Example

In this programming example, I will show how to interface a 16x2 character LCD with the Arduino Uno board. Arduino is very popular for electronic hobbyist, engineering projects, and DIY electronics, etc. A character LCD is very popular, low cost, and it's very easy to program. However this type of LCD use a parallel port interface that requires many wires. It's 8-bit wide, but the programmer can use only 4-bit mode to cut down the total in-circuit wires.

Arduino and 16x2 Character LCD Example
A running program on my prototyping board

In this example, I also use serial port to send character data to the Arduino Uno Board. Finally those data will send to the character LCD.

Arduino and 16x2 Character LCD Example
Schematic Diagram

We can also use tinkercad to draw and simulate this example using web browser.

Arduino and 16x2 Character LCD Example
Circuit View

Arduino Source Code:

  1. #include <LiquidCrystal.h>
  2.  
  3. LiquidCrystal lcd(7,8,9,10,11,12);
  4.  
  5. void setup(){
  6. Serial.begin(9600);
  7. lcd.begin(16,2);
  8. lcd.print("Arduino Uno LCD");
  9. lcd.setCursor(0,1);
  10. lcd.print("Example");
  11. delay(3000);
  12. lcd.clear();
  13. lcd.blink();
  14. }
  15.  
  16. void loop(){
  17. if(Serial.available()>0){
  18. char temp = Serial.read();
  19. lcd.print(temp);
  20. }
  21. }

Click here to download this example.


No comments:

Post a Comment

Labels

ADC (10) Analog (14) Arduino (12) Atmega16 (19) Audio (2) AVR (20) Charger (1) Cortex-M0 (1) Counter (10) CPLD (25) Digital I/O (22) Display (34) EEPROM (2) Environment Sensor (1) esp8266 (2) Experiment Board (10) I2C (4) Interrupt (7) LCD (1) LDmicro (29) measurement and instrumentation (7) Microchip Studio (3) MikroC (1) One-Shot (3) OpAmp (1) PCB (31) PIC16 Microcontrollers (16) PIC16F877A (2) PIC16F887 MikroC (22) PLC (35) PWM (11) Regulator (1) RTC (2) Sensor (8) Shift Registers (5) SPI (5) Timer (34) UART (2) ultra-sonic sensor (1) USB (1) VHDL (21) xc8 (1) XC95108 (9) XC9536 (15) XC9572 (1) Xilinx (23) Xilinx ISE (22)