This project shows how a monochrome bitmap image can be created and then displayed on the GLCD.
If a bitmap image is already available, we can use the mikroC Pro for PIC GLCD bitmap editor tool to convert the image into a data array, so that it could be used in a C program to display the image on the GLCD. Alternatively, we could create our own bitmap images using suitable programs. There are many tools for creating bitmap images. Perhaps the easiest way to create a bitmap image is by using the Windows Paint program, which is distributed free of charge with the Windows Operating System. In this project we will use the Paint program to create the image of a face with text and then display it on the GLCD. Notice that the created image or the available bitmap image must be monochromatic.
The steps in creating a bitmap image with the Paint program and then displaying on the GLCD are given below:
The block diagram of the project is shown in Figure 12.5.
The circuit diagram of the project is shown in Figure 12.6. The project is based on the PIC18F45K22 microcontroller, operating with an 8 MHz crystal (although most other types of PIC microcontrollers can also be used).
The connections between the GLCD and the microcontroller are as follows:
GLCD Pin | Microcontroller Pin |
CS1 | RB0 |
CS2 | RB1 |
RS | RB2 |
R/W | RB3 |
EN | RB4 |
RST | RB5 |
D0 | RD0 |
D1 | RD1 |
D2 | RD2 |
D3 | RD3 |
D4 | RD4 |
D5 | RD5 |
D6 | RD6 |
D7 | RD7 |
The contrast of the LCD is controlled by connecting a 10 KB potentiometer to pin Vo and Vee of the GLCD. The microcontroller is Reset using an external push-button.
If you are using the EasyPIC 7 development board, you should set the BCK jumper of SW4 to the +5 V position to enable the GLCD backlight. The GLCD contrast can be adjusted by the potentiometer located next to the display.
The PDL of this project is very simple and is given in Figure 12.7.
The program is named GLCD1.C and the program listing of the project is shown in Figure 12.8. At the beginning of the program, the bitmap array is declared using the code generated by the Bitmap Editor. Then, the connection between the microcontroller and the GLCD are defined using sbit statements. The GLCD is connected to ports B and D of the microcontroller and thus both of these ports are configured as digital I/O ports using ANSEL statements (different PIC microcontrollers may require different settings). The GLCD library is then initialised using the Glcd_Init function. This function must be called before calling to any other GLCD function. The GLCD screen is then cleared using the Glcd_Fill(0×0), which turns OFF all pixels of the GLCD. The created bitmap is then displayed on the GLCD by calling to function Glcd_Image and entering the name of the bitmap array as an argument.
Figure 12.9 shows the created image displayed on the GLCD.
3.145.66.241