Saturday, June 6, 2020

Interfacing 128x64 graphical LCD to PIC16F877A with CCS PICC example

An Overview Of Graphic LCD With KS0108 Controller

Graphic LCD commonly found in electronics equipment, comes with various sizes. It's actually a dot matrix display, made from tiny crystal points with display driver and controller. There are many different part numbers of display driver and controller.


An industrial standard ks0108 dot matrix graphic LCD controller. Currently there are many controller IC compatible with this one. This chip is embedded in a graphic LCD module with an 8-bit parallel port interface with some additional control pins. It could be found from any online store such as E bay or Amazon around 7 US Dollars. 


Interfacing 128x64 graphic LCD to PIC16F877A with CCS PICC example
A RT12864J-1 graphical LCD module

It comes with 20 pins connection.

Interfacing 128x64 graphical LCD to PIC16F877A with CCS PICC example
Pin diagram of KS0108 LCD Module

One KS0108 controller could drive 64 segment. Thus to get 128 segments they put two KS0108 controller IC. As we can see, we have two chip select pin for these two segments driver IC. Another common driver used for driving its common pins. It's KS0107 common driver. KS0107 could drive up to 64 common pins of the dot matrix.


C Programming And Interfacing With PIC16F877A


Many C compiler such as MikroC and CCS PICC develop a library for this controller IC. CCS PICC is fast and efficient. In this example, I use PIC16F877A to interface with a 128x64 LCD module controlled by KS0108/KS0107 IC.


Interfacing 128x64 graphical LCD to PIC16F877A with CCS PICC example
Schematic Diagram. The LCD module in Proteus different in pin outs.
But it functions the same to the physical hardware.

The overall program just show the power up time of the system that being run by PIC16F877A.


#include <16F877A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#define GLCD_CS1     PIN_B0   
// Chip Selection 1
#define GLCD_CS2     PIN_B1   
// Chip Selection 2
#define GLCD_DI      PIN_B2   
// Data or Instruction input
#define GLCD_RW      PIN_B3   
// Read/Write
#define GLCD_E       PIN_B4   
// Enable
#define GLCD_RST     PIN_B5   
// Reset
#define xOffSet 25
#include <HDM64GS12.c>
#include <graphics.c>


void main() {
   char txt1[]="Start Up Time:";
   char timeString[15];
   int timeCounter=0;
   int second=0;
   int minute=0;
   int hour=0;  
   glcd_init(ON);  
   glcd_text57(23,15,txt1,1,ON);
   while(1){
      /* Get time in second*/
      second=timeCounter;
      if(second>60){
         minute+=1;
         timeCounter=0;
         
      }
      if(minute>60){
         hour+=1;
         minute=0;
      }
      if(hour>24) hour=0;
      /*convert number to string data*/
      sprintf(timeString,"%u:%u:%u",hour,minute,second);
      /*Clear the old value using a mask rectangle*/
      glcd_rect(23,25,120,40,YES,OFF);
      /*Show the time text string*/
      glcd_text57(23,25,timeString,2,ON);            
      delay_ms(1000);
      timeCounter+=1;
   }
}
Interfacing 128x64 graphical LCD to PIC16F877A with CCS PICC example KS0108 Display controller Microchip PIC Timer
The simulation screen shot

If you want a standard PCB for ATMega32 micro-controller, you can order my AVR Microcontroller project from PCBWay with a reasonable price. Click here to get a free $5 credit for new account.

Interfacing ATMega32 to 74HC595 shift register
ATMega16 ATMega32 Experiment Board PCB from PCBWay

 

We can the ATMega32 micro-controller to interface with this graphical LCD module. Check this link for more information.

8 comments:

  1. This is actually good to read content of this blog. A is very general and huge knowledgeable platform has been known by this blog. I in reality appreciate this blog to have such kind of educational knowledge. graphic LCD

    ReplyDelete
  2. Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. TV BF Deals

    ReplyDelete
  3. I curious more interest in some of them hope you will give more information on this topics in your next articles. JBL Pulse 3

    ReplyDelete
  4. Recruitment Technology has for a long time fallen behind the developments in other professional industries such as accounting, legal, insurance etc. with a number of excellent technology tools and software products being developed in these areas. Recently though their has been a surge of development within recruitment technology with some truly fantastic products being developed to take us out of the dark ages of recruitment methodologies. But if recruiters don't embrace this development we will hinder our progress into the future. Programming Help

    ReplyDelete
  5. Thank you very much.Very informative and impressive post you have written.HDMI Display with USB TouchScreen manufacturers

    ReplyDelete
  6. There is quite a bit of misinformation and hype about electric vehicles. In this article, a group of motorsports enthusiasts dig deeper into the realities, myths, and misconceptions many people have about electrics. Even if you currently do not have interest in an electric vehicle, this information does impact you. https://electricity24.nl/

    ReplyDelete

Search This Blog

Labels

25AA010A (1) 8051 (7) 93AA46B (1) ADC (30) Analog Comparator (1) Arduino (15) ARM (6) AT89C52 (7) ATMega32 (56) AVR (57) CCS PICC (28) DAC (1) DHT11 (2) Display (105) Distance Sensor (3) DS18B20 (3) dsPIC (2) dsPIC30F1010 (2) EEPROM (5) Environment Sensor (4) esp8266 (1) I2C (29) Input/Output (67) Interrupt (19) Keil (5) Keypad (10) LCD (47) Master/Slave (1) MAX7221 (1) MCP23017 (5) MCP23S17 (4) Meter (3) MikroC (2) Motor (15) MPLABX (71) Nokia 5110 LCD (3) OLED (2) One-Wire (6) Oscillator (8) PCB (6) PCD8544 (3) PCF8574 (5) PIC (107) PIC12F (2) PIC16F628A (2) PIC16F630 (1) PIC16F716 (3) PIC16F818 (10) PIC16F818/819 (2) PIC16F84A (15) PIC16F876A (1) PIC16F877A (9) PIC16F88 (1) PIC16F887 (60) PIC18 (19) PIC18F1220 (4) PIC18F2550 (3) PIC18F4550 (12) PWM (11) RTC (8) Sensor (10) SH1106 (1) Shift Register (11) Shift Registers (3) SPI (24) STM32 (6) STM32 Blue Pill (6) STM32CubeIDE (6) STM32F103C8T6 (6) SysTick (3) temperature sensor (11) Thermometer (21) Timer/Counter (31) TM1637 (2) UART (7) Ultrasonic (4) Voltmeter (7) WDT (1) XC16 (2) XC8 (94)