Книга: Advanced PIC Microcontroller Projects in C
Project Description
Project Description
In this project a voltmeter with LCD display is designed. The voltmeter can be used to measure voltages 0–5V. The voltage to be measured is applied to one of the analog inputs of a PIC18F452-type microcontroller. The microcontroller reads the analog voltage, converts it into digital, and then displays it on an LCD.
In microcontroller systems the output of a measured variable is usually displayed using LEDs, 7-segment displays, or LCD displays. LCDs make it possible to display alphanumeric or graphical data. Some LCDs have forty or more character lengths with the capability to display several lines. Other LCD displays can be used to display graphics images. Some modules offer color displays, while others incorporate backlighting so they can be viewed in dimly lit conditions.
There are basically two types of LCDs as far as the interface technique is concerned: parallel and serial. Parallel LCDs (e.g., Hitachi HD44780) are connected to a microcontroller by more than one data line and the data is transferred in parallel form. Both four and eight data lines are commonly used. A four-wire connection saves I/O pins but is slower since the data is transferred in two stages. Serial LCDs are connected to the microcontroller by only one data line, and data is usually sent to the LCD using the standard RS-232 asynchronous data communication protocol. Serial LCDs are much easier to use, but they cost more than the parallel ones.
The programming of a parallel LCD is a complex task and requires a good understanding of the internal operation of the LCD controllers, including the timing diagrams. Fortunately, the mikroC language provides special library commands for displaying data on alphanumeric as well as graphic LCDs. All the user has to do is connect the LCD to the microcontroller, define the LCD connection in the software, and then send special commands to display data on the LCD.