7.4 Example GLCD Display
An example program is given in this section, to show how the various GLCD library functions can be used. The example program listing is shown in Figure 7.5. Notice that at the beginning of the program, PORT B and PORT D I/O pins are configured as digital by clearing ANSELB and ANSELD registers to 0. This is necessary, since we are using a PIC18F45K22 type microcontroller. Different PIC microcontrollers may require different settings to configure their analogue ports as digital. The images displayed by this program are shown in Figure 7.6. This image was obtained by connecting a GLCD to the EasyPIC 7 development board. The following shapes are drawn on the GLCD:
- a rectangle with rounded edges at co-ordinates (5, 5), (123, 59) and edge radius 10;
- a rectangle at co-ordinates (15, 15), (113, 49);
- a line from (50, 30) to (70, 30);
- a circle with centre at (30, 30) and radius 10;
- a filled circle with centre at (50, 42) and radius 5;
- text ‘Txt’ at x co-ordinate 80 and page 3;
- text ‘LCD’ at x co-ordinate 80 and page 4;
- text ‘micro’ at co-ordinates (80, 38).
The functions used to display each image are also shown in Figure 7.6.
Figure 7.5 Example GLCD program
Figure 7.6 Images displayed by the program in Figure 7.5
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access