Aim:
This tutorial describes how to interface between a 128×64 graphic LCD and an 8-bit
micro-controller. The techniques described here are useful for any other controller type and interfacing technique. The micro-controller is connected via its I/O lines and all signals to the LCD are controlled directly by software.
micro-controller. The techniques described here are useful for any other controller type and interfacing technique. The micro-controller is connected via its I/O lines and all signals to the LCD are controlled directly by software.
Description:
Display mapping: Individual pixels can be controlled by writing a byte to a specific address. Each address is mapped to a corresponding set of 8 pixels on the display. Please refer to Figure 1. Note that the order of the columns is reversed. The first byte of data entered after setting the address registers to 0 will appear in the upper right of the display.
The display has 20 pins, numbered from right to left, as we can see in the picture below. It can be used to communicate with the any microcontroller using parallel communication. In this article, where the LCD refresh rate is not a critical point, we will use the parallel communication
The circuit uses a potentiometer (used a 50K) for adjusting the display contrast, and power is made by 5v power supply.
The specification of this LCD are as follows.
- 128 horizontal pixel and 64 vertical pixel resolution.
- Controlled based on KS0108B
- Parallel 8bit interface
- On board graphic memory.
- Available in Green backlight with dark green pixels.
- Also available in Blue backlight with light blue pixels.
- LED backlight.
- 20 PIN linear connection.
PIN Description
PIN | Name | Function | Connection with AVR PIN |
1 | Vss | Ground | |
2 | Vcc | +5v Supply in | |
3 | V0 | Contrast Adjust | |
4 | RS | Instruction/Data Register Select | A3 |
5 | R/W | READ/WRITE SELECTION | A2 |
6 | E | ENABLE SIGNAL | A4 |
7 | DB0 | DATA IN/OUT | 8 |
8 | DB1 | DATA IN/OUT | 9 |
9 | DB2 | DATA IN/OUT | 10 |
10 | DB3 | DATA IN/OUT | 11 |
11 | DB4 | DATA IN/OUT | 4 |
12 | DB5 | DATA IN/OUT | 5 |
13 | DB6 | DATA IN/OUT | 6 |
14 | DB7 | DATA IN/OUT | 7 |
15 | CS1 | Chip Select 1 | A1 |
16 | CS2 | Chip Select 2 | A0 |
17 | RST | RESET SIGNAL | RESET |
18 | VEE | NEGATIVE 10V OUT | |
19 | LED+ | LED BACKLIGHT | |
20 | LED- | LED BACKLIGHT |
Block Diagram
Schematic
Code
// *******************************************************
// Project: Interfacing Graphical LCD with Arduino
// Author: Hack Projects India
// Module description: Operate Graphical LCD
// *******************************************************
// include the library header
#include <glcd.h>
#include "config/ks0108_Mega.h" // Para Arduino Mega
// include the Fonts
#include <fonts/allFonts.h>
void setup()
{
// Initialize the GLCD
GLCD.Init();
// Select the font for the default text area
GLCD.SelectFont(System5x7);
GLCD.ClearScreen();
GLCD.CursorTo(0, 0);
// GLCD.print("LCD Grafico!");
//GLCD.print("123456789012345678901");
GLCD.print("Hack Projects India");
//delay(3000);
}
void loop()
{
}
Downloads:
To download code and proteus simulation click here.
Further Reading suggestions:
You may also like,
No comments:
Post a Comment