11.4 PROJECT 11.4 – Creating Custom Fonts on the LCD

There are some applications where we may want to create custom fonts, such as special characters, symbols or logos on the LCD. This project will show how to create the symbol of an arrow pointing upwards on the LCD, and then display ‘Up arrow - <symbol of up arrow>’ on the first row of the LCD.

mikroC Pro for PIC compiler provides a tool that makes the creation of custom fonts very easy. The steps for creating a font of any shape are given below:

  • Start mikroC Pro for PIC compiler.
  • Select Tools -> LCD Custom Character. You will see the LCD font editor form shown in Figure 11.11.
  • Select 5 × 7 (the default).
  • Click ‘Clear all’ to clear the font editor.
  • Now, draw the shape of your font by clicking on the squares in the editor window. In this project, we will be creating the symbol of an ‘up arrow’, as shown in Figure 11.12.
  • When you are happy with the font, click the ‘mikroC Pro for PIC’ tab so that the code generated will be for the mikroC Pro for PIC compiler.
  • Click Generate Code' button. You will get the code, as shown in Figure 11.13.
  • Click ‘Copy Code To Clipboard’ to save the code.
  • We shall see later in the project how to display this font using the generated code.

Figure 11.11 LCD font editor

img

Figure 11.12 Creating an ‘up arrow’ font

img

Figure 11.13 Generating code for the font

img

11.4.1 Block Diagram

The block diagram of the project is as in Figure 11.1.

11.4.2 Circuit Diagram

The circuit diagram of the project is as in Figure 11.2.

11.4.3 Project PDL

The PDL of this project is very simple and is given in Figure 11.14.

Figure 11.14 PDL of the project

img

11.4.4 Project Program

The program is named LCD4.C and the program listing of the project is shown in Figure 11.15. At the beginning of the project, the connections between the microcontroller and the LCD are defined using sbit statements. PORT B is configured as a digital output port. The LCD is initialised, cleared and the cursor is turned OFF. Then the Lcd_Out function is called to display the text ‘Up arrow – ’, starting at row 1 and column 1 of the LCD. Function CustomChar is generated by the compiler and this function displays the created font at the specified row and column positions.

Figure 11.15 Program listing of the project

img

img

Figure 11.16 shows a picture of the LCD display.

Figure 11.16 The LCD display

img
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.105.193