GLCD Library - Osama's Lab
GLCD Library - Osama's Lab
1 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
Introduction
Osamas Lab GLCD Library is used for controlling KS0108 dependent graphic LCD
modules, it provides a number of easy to use funcons for reading and wring
from and to the RAM of the GLCD.
Features
Compable with CodeVisionAVR and GCC (two versions)
Character spacing
Drawing the following geometric shapes, each can be drawn solid, doed, or
dashed, even the length of dashes can be controlled!
o Horizontal lines
o Vercal lines
o Inclined lines
2 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
o Horizontal parallelograms
o Vercal parallelograms
o Horizontal parallelepipeds
o Vercal parallelepipeds
o Circles
Function summary
The following funcons are provided by the library:
bmp_disp
circle
cuboid
glcd_clear
glcd_clrln
glcd_o
glcd_on
glcd_putchar
glcd_puts
glcd_read
glcd_write
goto_col
goto_row
goto_xy
h_line
h_parallelepiped
h_parallelogram
line
point_at
rectangle
set_start_line
v_line
v_parallelepiped
v_parallelogram
3 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
4 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
5 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
6 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
7 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
second surface
8 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
perimeter points:
0 solid line
1 doed line
>1 dashed line
c: 0 Light spots
1 Dark spots
glcd_putchar(byte c,int x,int Writes a character at c: The character to be
y,byte l, byte sz) the specied typed
posion, with size sz x: The column number to
start typing the character
at (One character
occupies 8 columns)
y: The row number to
type the character at
l: The language of the
character
0 English
1 Arabic
sz: Font size (from 1 to 7)
Writes a string c: A pointer to the string
glcd_puts(
,stored in the ash to be wrien on the
byte *c,int x,int y,unsigned memory ,on the display
char l, byte sz,signed char display x: The column number to
space) start typing the character
at (One character
occupies 8 columns)
y: The row number to
type the character at
l: The language of the
character
0 English
1 Arabic
sz: Font size (from 1 to 7)
space:
English: Character spacing
Arabic and Farsi:Word
spacing
bmp_disp(ash byte *bmp, Displays a bmp image bmp: A pointer to the
unsigned int x1,unsigned int y1, array stored in the array where the bmp
unsigned int x2,unsigned int y2) ash memory image is stored
x1: The x of the upper le
point of the image on the
glcd
y1: The y of the upper le
point of the image on the
9 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
glcd
x2: The x of the lower
right point of the image
on the glcd
y2: The y of the lower
right point of the image
on the glcd
[1]
Each row consists of 8 lines, hence, the GLCD contains 8 rows and 64 lines
[2]
The column number is just used for enabling the appropriate GLCD half
For exibility, ports used for interfacing the graphic LCD arent inialized by the
library, you must inialize them at the start of your program:
Some compilers dont support Arabic texts, you can type any Arabic string
you want in the code, and it will be displayed properly on the GLCD even if it
appears in the code editor improperly:
There are two versions of the library, CodeVisionAVR version and gcc
version, if you use gcc version, only one port can be used as a control port,
but if you use CodeVisionAVR version, each control pin can be specied
separately.
CodeVisionAVR gcc
#dene CS1 PORTC.2 #dene CONTROLPORT PORTC
#dene CS2 PORTC.3 #dene CS1 (1<<2)
#dene RS PORTD.7 #dene CS2 (1<<3)
#dene RW PORTC.0 #dene DI (1<<4)
#dene EN PORTC.1 #dene RW (1<<0)
#dene EN (1<<1)
10 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
You can specify control pins You can select the order of control
individually and in dierent pins, but they must be in the same
ports port
Some graphic LCD modules use acve low enable pins, while other
modules use acve high enable pins, refer to the datasheet before you use
the library to know to which type your module belongs, then it is easy to tell the
library which type it uses by un/commenng the #dene CS_ACTIVE_LOW in
the library.
From the NA
datasheet
- Extract the compressed le, and include glcd.h into your project, font.h
is included implicitly by glcd.h.
11 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
How to
Read the contents of a certain locaon on the display
Draw solid, doed, and dashed lines and shapes
Specify the color of lines and shapes
Move the whole contents of the display up and down without repainng
Write Arabic and English texts
12 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
Hardware connections
The order of the pins diers from a module to another, so before you connect your
hardware please double check your connecons not to connect any wire
improperly, this may damage your module, the order and the name of each pin can
be found in the datasheet under a secon named Terminal Funcons or a similar
name.
Examples
There are four illustrave examples:
CodeVisionAVR with acve HIGH GLCD
13 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
- For compiling GCC projects, I used eclipse with AVR eclipse plug-in.
- Download CodeVisionAVR
License
This program is free soware: you can redistribute it and/or modify it under the
terms of the GNU Aero General Public License as published by the Free Soware
Foundaon, either version 3 of the license.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the
GNU Aero General Public License for more details.
You should have received a copy of the GNU Aero General Public License along with
this program. If not, seehp://www.gnu.org/licenses/
FAQ
How to turn on/o the backlight?
How to reset the GLCD module?
Can I assign control pins that belong to dierent ports?
The GLCD displays hazy or messy paints and texts, what is the problem?
The backlight shines, but nothing appears on the display, what is the
problem?
Only one half of the display work, what is the problem?
How can I adjust the contrast of the display?
How can I change the font?
How can I ask a queson not listed here?
14 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
The GLCD displays hazy or messy paints and texts, what is the
problem?
Make sure that the data port and control pins are dened properly at the
library header le
Make sure that you set the data direcon of the data port and the control port
properly, remember, the data direcon registers are not set by the library, you
must set them manually.
This problem is mostly caused by the delay me, try increasing the dened
delay me at the start of the library header le:
#dene E_DELAY 3
If it didnt work, try increasing the other delays at the dierent funcons of the
library
Bad connecons can also cause such problems, double check your
connecons
Poor power supplies may also be the reason, ensure that your power supply is
sucient
15 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
Make sure that the data direcon registers, the control pins, and the data port
are inialized properly (Refer to"Before you begin" secon).
Version History
Ver. 2.00
References
KS0108 datasheet
If you have any queson, suggeson, note, found a bug, or like to say anything, please
don't hesitate to contact me.
Thanks,
16 of 17 13-Nov-17, 9:18 AM
GLCD Library - Osama's Lab file:///D:/reema/r/New folder/re/New folder (2)/ec/pic24/GLCD Library ...
See also
Arabic - English Graphic LCD Library (controller KS0108)
Displaying a BMP Image on a graphic LCD (controller KS0108)
- Feedback
- Download this documentation in pdf
- Subscribe to Osama's Lab newsletter
Sign in | Report Abuse | Print Page | Remove Access | Powered By Google Sites
17 of 17 13-Nov-17, 9:18 AM