Monochromatic graphical LCD - eclubiitk/EClub-Handbook GitHub Wiki

The monochromatic GLCD used is JHD12864. The datasheet can be downloaded from http://cnpdf.alldatasheet.com/datasheet-pdf/view/276158/JHD/JHD12864G.html.

You will require AVRLib which can be downloaded from http://linux.softpedia.com/progDownload/AVR-Libc-Download-7401.html and unzipped. The MCU used is an

ATMega16 or ATMega32. Open AVRStudio4. From File->New create a project named GLCD. Choose the location for your project (I choose C:\Desktop). Follow the normal steps as in WinAVR till your Project window is opened. Your source files contain only one file GLCD.c.

Open AVRLib Copy & Paste glcd.c and glcd.h files to your project folder(C:\Desktop\GLCD).Now Drag & Drop glcd.c to the Source files and glcd.h to the Header files. Compile the file. Some errors will be shown in the Build box indicating that some files doesn't exist with some other errors.

Just drag and drop the files which don’t exist in the same way as glcd.c and glcd.h while ignoring other errors.

The files you have to include are global.h, ks0108.h, ks0108conf.h, ks0108.c, avrlibdefs.h, avrlibtypes.h, font5x7.h, fontgr.h, glcd.c, glcd.h.

Open ks0108conf.h and you will find statements such as:

#ifndef GLCD_CTRL_PORT

#define GLCD_CTRL_PORT PORTA // PORT for LCD control signals

#define GLCD_CTRL_DDR DDRA // DDR register of LCD_CTRL_PORT

#define GLCD_CTRL_RS PA4 // pin for LCD Register

This shows you the corresponding connections to be made between the GLCD and MCU. For ex. GLCD_CTRL_RS PA4 means connect RS (PIN 4 of GLCD) to PINA4 of MCU. You can configure the ports as you wish. Some changes to be done, CS0 and CS1 have to be treated as CS1 and CS2 of GLCD. D/I have to be treated as RS, while CS2 and CS3 don’t exist in the GLCD to be connected. You can delete the statements of CS2 and CS3 and use the MCU pins for other purposes.


In the GLCD.c file write the following program for checking GLCD:

#include <avr/io.h>
#include "glcd.h"
#include "ks0108.h"
int main(void)
{
glcdInit();
glcdPutStr("The GLCD is working");
}

Screenshot (130)


⚠️ **GitHub.com Fallback** ⚠️