PIC Lesson: LCD KS0108


Graphic LCD memberikan lebih banyak pilihan character yang ingin dipaparkan berbanding Character LCD. Salah satu GLCD adalah menggunakan controller KS0108. Antara saiz pixel GLCD ini adalah 128X64. GLCD KS0108 mempunyai 20pin. Di bawah adalah gambar GLCD KS0108.

Di bawah adalah skematik untuk GLCD KS0108.

Lihat document di bawah untuk instruction GLCD.

Berikut adalah videonya.

PIC Source Code

/*
Project: GLCD KS0108 Lesson, 128X64 GLCD Example
Programmer: Shahrulnizam Mat Rejab
PIC (Crystal Frequency):
PIC16F877A (20MHz), PIC16F887 (20MHz), PIC16F1939 (Internal 32MHz) 
PIC18F4520 (10MHz), PIC18F4550 (10MHz), PIC18F46K22 (Internal 16MHz)
Compiler: HI-TECH C for PIC10/12/16 V9.83, PIC18 V9.80
Last Modified: 28 October 2014
Website: http://shahrulnizam.com
*/

#define	KS0108

#include "LibraryHardware.h"
#include "LibraryChar.h"
#include "LibraryUniversalDisplay.h"
#include "LibraryDataImg.h"

void setup()
{
initialize();
TRISA=0b00000000;
TRISB=0b00000000;
TRISC=0b00000000;
TRISD=0b00000000;
TRISE=0b00000000;
BUZZER=1;
glcd_init();	
}

void loop()
{
int i,j;
for(i=0;i<8;i++){
    glcd_goto(i,0);
    for(j=0;j<64;j++) glcd_write(img1[128*i+j]);
    glcd_goto(i,64);
    for(j=64;j<128;j++) glcd_write(img1[128*i+j]);}
delay(1000);

for(i=0;i<8;i++){
    glcd_goto(i,0);
    for(j=0;j<64;j++) glcd_write(img2[128*i+j]);
    glcd_goto(i,64);
    for(j=64;j<128;j++) glcd_write(img2[128*i+j]);}
delay(1000);
}

37 responses to “PIC Lesson: LCD KS0108”

  1. Salam En Shahrul,

    Boleh saya tanya, adakah cara initialize untuk PIC32 sama mcm ni jugak?sebab saya dah try initialize tp tak dapat.xtau apa masalahnya.Susah nak jumpa sample yg guna PIC32 yg connect dgn GLCD..
    Mohon Encik sudi jawab ye..

  2. Wasalam encik nizam..
    boleh x bagitau saya kat maner nak dapatkan lcd nie kat malaysia..?
    dan angaran harga lcd tersebut…

    terima kasih atas tutorial diatas 😀

  3. I have tried your code with 8mhz crystal on mikroelektronikas easypicv7
    i have rearange pins as
    Rb5 rst
    Rd pins data
    Rb4 enable
    rb3 rw
    rb2 rs
    but when i run it on demoboard even backlight of glcd goes off
    could you help me please
    it is urgent
    best regards.

  4. hello shahrul,

    May i know how many days it took for them to deliver the glcd from ebay since you ordered? Do you have another piece of that glcd for sale, i would like to have it for my final year project. Nice post anyway…

    Regards

  5. Assalamulaikum, En.Shahrul boleh k klu sy guna GLCD jenis lain tp guna prinsip programming yg en.shahrul guna?

  6. Ha3… sy dah terbaca smlm sal dia punya controller, tp skg ne sy punya GLCD berbeza Pixel.. still boleh apply programming 2 kn.

  7. Assalamulaikum, En.Shahrul sy ada go through header “LibraryUniversalDisplay.h” dlm slot Header… kebanyakan coding 2 sy faham. Yg sy x faham adalah function glcd_gotox(unsigned char c); glcd_gotoy(unsigned char c); glcd_gotoz(unsigned char c);

  8. Assalamulaikum, Sy dah faham ape function coding 2… tp sy nak tanya gak le, coding ne bukan terus boleh tulis text kat mane2 location dlm GLCD 2 kn…

  9. Hey man, I saw that you have been made a very nice job, but I didn’t see where is the link that you share your codes with us. It is possible or you don’t do this anytime. Thanks a lot!

  10. Sorry Shahrul, thanks for your reply. I asked that because I saw some comments below about the code, but how much a code like this example with source.h and source.c cost?

  11. hi can you please send me your library files
    #include “LibraryHardware.h”
    #include “LibraryChar.h”
    #include “LibraryUniversalDisplay.h”
    #include “LibraryDataImg.h”

Leave a Reply to Shahrul Cancel reply

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