11.3 PROJECT 11.3 – Counting with the LCD
In this project, we will see how to display numbers in addition to text on the LCD. Here, an up-counter will be designed that will count with 1 second intervals. The count will be displayed as follows:
11.3.1 Block Diagram
The block diagram of the project is as in Figure 11.1.
11.3.2 Circuit Diagram
The circuit diagram of the project is as in Figure 11.2.
11.3.3 Project PDL
The PDL of this project is very simple and is given in Figure 11.8.
11.3.4 Project Program
The program is named LCD3.C and the program listing of the project is shown in Figure 11.9. At the beginning of the project, the connections between the microcontroller and the LCD are defined using sbit statements and the counter variable, Cnt, is initialised to 0. In the main program, PORT B is configured as a digital output port. The LCD library is initialised, LCD is cleared, and the cursor is turned OFF. Then an endless loop is formed using a for statement. Inside this loop, the counter variable Cnt is incremented by one. This variable is then converted into a string using the mikroC Pro for PIC built-in library function ByteToStr. Here, the numeric variable is the first argument, and address of a character array, where the converted string ...
Get Using LEDs, LCDs and GLCDs in Microcontroller Projects now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.