fbpx

LCD Display

Liquid crystal display is a very essential part in all embedded devices from the calculator to printing machines, LCD works with voltage pluses, with two are more kind of ic drivers in LCD display form LCD module.

Hardware Required

  • Raspberry pi
  • LCD Module.
  • Potentiometer.
  • Connecting wires.

Circuit

Code

 import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)  //BCM is broadcom which specifies the actual pin number considered by broadcom chip 
GPIO.setwarnings(False)  //Ignore warnings
GPIO.setup(24  ,GPIO.OUT)  //RS pin
GPIO.setup(23  ,GPIO.OUT)  //enable pin
GPIO.setup(13  ,GPIO.OUT)  //data pins D0-D7 for LCD
GPIO.setup(19  ,GPIO.OUT)
GPIO.setup(26  ,GPIO.OUT)
GPIO.setup(21  ,GPIO.OUT)
GPIO.setup(20  ,GPIO.OUT)
GPIO.setup(16  ,GPIO.OUT)
GPIO.setup(12  ,GPIO.OUT)
GPIO.setup(25  ,GPIO.OUT)
 
def  command-to_lcd(a):
pin=a
PORT(pin):
GPIO.output(4,0)
GPIO.output(5,1)      
time.sleep(1)
GPIO.output(5,0)
pin=0
PORT(pin):
 
def  character-to_lcd(a):
pin=a
PORT(pin):
GPIO.output(4,1)
GPIO.output(5,1)      
time.sleep(1)
GPIO.output(5,0)
pin=0
PORT(pin):
while 1:
command_to_lcd(0x38);
command_to_lcd(0x0C);
command_to_lcd(0x01);
Character_to_lcd(0x49);     //ASCII code for I
Character_to_lcd(0x4D);     //ASCII code for M
Character_to_lcd(0x41);     //ASCII code for A
Character_to_lcd(0x4B);     //ASCII code for K
Character_to_lcd(0x45);     //ASCII code for E
 time.sleep(1)
GPIO.cleanup()
  

Leave a Reply

Your email address will not be published. Required fields are marked *