Projects   /   LCD & Display Projects   /   PIC16F877A

Displaying Images on Graphical Lcd(JHD12864E) using Pic16f877 Microcontroller

Here in this post i am going to teach you how to display images on Graphical lcd using Pic Microcontroller(16F877).

Published
Updated

At a glance

CategoryLCD & Display Projects
PIC modelPIC16F877A
IncludesCircuit diagram
Reading time~5 min

Summary of Displaying Images on Graphical Lcd(JHD12864E) using Pic16f877 Microcontroller

Summary: This article explains how to display monochrome BMP images on a JHD12864E 128x64 graphical LCD using a PIC16F877 microcontroller. It covers image conversion to 128x64 BMP, generating bitmap arrays with The Dot Factory, hardware wiring (data on PORTB, control on PORTD and PORTC), and C code functions for delays, LCD commands/data, chip-selects, and image creation compiled with Hi-Tech C in MPLAB.

Parts used in the Displaying Images on Graphical Lcd (JHD12864E) using Pic16f877 Microcontroller:

  • PIC16F877 microcontroller
  • JHD12864E graphical LCD (128x64)
  • Connection wires
  • Power supply for microcontroller and LCD
  • PC with MPLAB IDE
  • Hi-Tech C compiler
  • The Dot Factory software (for generating bitmap arrays)
  • Image editing or online image dimension converter tool

Here in this post i am going to teach you how to display images on Graphical lcd using Pic Microcontroller(16F877). I am using JHD12864E graphical LcD in my Project. JHD12864E is 128x64 dimension lcd. 128x64 means it has 128 coulombs and 64 rows. So total dots it has is 128x64=8192. You can display an image of maximum size(Dimension = 128x64) with in this range. Some notable things..

You can only display images of .bmp format. Images bitmaps are obtained only by .bmp format. Graphical lcds consists of dots, we have to display our images using these dots and .bmp image is also comprised of dots. we can easily find bits of images of .bmp format and can map them on Graphical lcd.

Displaying Images on Graphical Lcd(JHD12864E) using Pic16f877 MicrocontrollerYou can only display black and white images(Monochrome images bitmap is hard to generate. Non software is found for generating bitmap of monochrome images on internet).

  • If you want to display images of size greater than 128x64 than first change the size of the image. I used an online image dimension converter(My image size is 960x1280. I converted it to 128x64 using an online image dimension converter. You can found many tools to convert images just Google for it).  
  • If you are new to graphical lcd and didn't know much about it just go through the tutorial below. You will become familiar with graphical lcd, its half and pages, its commands, its pin out and how to effectively use it. It will help you in understanding the code given below.
The first pic which i am going to display is mine(The Admin). Its original size is 960x1280, format is .jpg and its a monochrome pic. I converted it to black and white, format .bmp and size is reduced to 128x64 using an online software for image editing.
Now when you converted images its time to find bitmaps. Bitmaps are found using special softwares. I used an open source software The Dot Factory. Just give the path of the image and click generate it will generate bitmap with in a second. Download the software here... 

Dot factory not only generates bitmaps it also gives you the dimension of the newly generated bitmaps. Once bitmaps code is generated you can copy them from their and place them in your code.

Pic16f877 microcontroller is used to display images on jhd12864E graphical lcd. Port-B is used to send data and commands to graphical lcd. It is connected to data pins D0-D7 of Graphical lcd. Lcd controlling pins en(Enable),rs(Register-select),rw(read-write) are connected to Port-D pins#7,6,5. Graphical lcd's First-Half selection line is connected to Port-D Pin#4 and second-half selection line is connected to Port-C Pin#4.

oming to the code portion. Code is written in C++ language using MPLAB-IDE and HIGH-TECH C compiler is used to compile and generate hex code of the project.

Functions in the code with their functions are explained below....
Displaying Images on Graphical Lcd(JHD12864E) using Pic16f877 Microcontroller Schematicvoid delay(unsigned int d)
Delay Function is used to generate some arbitrary delay to be used in the code where necessary.
void lcdcmd(char value)
This function is sending commands to lcd. It not only send commands but also manipulate the lcd controlling pins(en,rw,rs) high and low to succesfully execute the commnad.
void lcddata(char data1)
This function is sending data to lcd. It not only send data but also manipulate the lcd controlling pins(en,rw,rs) high and low to succesfully display data on lcd.
void CS1()
This function is selecting first half of JHD12864E graphical lcd.
void CS2()
This function is selecting Second half of JHD12864E graphical lcd.
void createimage(const char *image)
Create image function is creating image on JHD12864E graphical lcd.

  • What image format can be displayed on the JHD12864E graphical LCD?
    Only BMP format images can be displayed according to the article.
  • Can the graphical LCD display color images?
    No, the article states only black and white (monochrome) images can be displayed.
  • What is the maximum image dimension supported by the JHD12864E?
    The maximum image size is 128x64 pixels as stated in the article.
  • How do you obtain the bitmap data for an image?
    Use software like The Dot Factory to generate bitmap arrays from a BMP image.
  • Which microcontroller port is used to send data and commands to the graphical LCD?
    PORTB of the PIC16F877 is used to send data and commands to the LCD.
  • Where are the LCD control pins connected on the PIC16F877?
    Enable, RS, and RW pins are connected to PORTD pins 7, 6, and 5 respectively per the article.
  • How are the first and second halves of the JHD12864E selected?
    CS1 selects the first half (function CS1) and CS2 selects the second half (function CS2); hardware lines are on PORTD pin 4 and PORTC pin 4 respectively.
  • Which compiler and IDE are used for the project code?
    Code is written in C using MPLAB IDE and compiled with the Hi-Tech C compiler.
Beginner Tutorials · PIC16F877A

PIC16F877 Driving LCD in 4-Bit Mode using PIC16F877 with Proteus Simulation

Introduction This microcontroller project shows how a PIC16F877 can drive an LCD display using 4-bit mode inside a Proteus simulation.The project demonstrates...

Programmers & ICSP · PIC16F877A

EPE PIC/LCD Demo using PIC16F877 with Proteus Simulation

IntroductionThe EPE PIC/LCD Demo is a classic microcontroller project that demonstrates how a PIC16F877 can fully control a PG12864F graphical LCD.Designed as...

Motors & Robotics · PIC16F877A

Efficient Sun-Following Robot: A Solar Tracker with Microcontroller Control

Abstract The impending global challenge of dwindling non-renewable fuel resources underscores the urgency of transitioning towards renewable energy alternatives like solar power....

LCD & Display Projects

Leveraging Blockout Banners for Effective Electronics and Tech Product Displays

Blockout banners have become a popular and effective tool for displaying electronics and tech products in various settings, from trade shows and...

LCD & Display Projects · PIC18F4520

Interfacing PIC18F4520 microcontroller with an HD44780 LCD

Introduction Being able to display data from a microcontroller visually has many advantages. It allows for menus, status indicators, and instructions to...

LCD & Display Projects

Video Project Development in the Midst of an Impromptu Online Semester

Receiving robot parts in the mail was an unexpected conclusion to the Winter 2020 semester for students. However, when faced with a...

Ibrar Ayyub

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough...