LCD TUTORIAL WITH MICROCONTROLLER PIC

LCD 16 × 2
The LCD (Liquid Crystal Display) or liquid crystal display is a device used to display content or information in a graphic way, using characters, symbols or small drawings depending on the model.

In this case, we are going to use a 16 × 2 LCD, this means that it has 2 rows of 16 characters each. The pixels of each symbol or character varies depending on each model

LCD

The LCD consists of 16 terminals which we can divide into power, control, and bidirectional data bus pins. In general, we can also find in its structure the pins of the led backlight anode and the led backlight cathode.LCD terminals

Power pins
Vss: Gnd
Vdd: +5 volts
Vee: corresponds to the contrast pin, we will regulate it with a 10K potentiometer connected to Vdd.

Control pins
RS: Corresponds to the data control register (0) or data register (1) selection pin. That is, the RS pin works parallel to the pins of the data bus. When RS is 0, the data present on the bus belongs to a control/instruction register. and when RS is 1 the data present in the data bus belongs to a data record or a character.
RW: Corresponds to the Write (0) or Read (1) pin. It allows us to write data on the screen or read data from the screen.
E: Corresponds to the Enable or enable pin. If E (0) this means that the LCD is not activated to receive data, but if E (1) is active and we can write or read from the LCD.
Data Bus pins
The bidirectional data bus comprises from pins D0 to D7. To communicate with the LCD we can do it using the 8 bits of the data bus (D0 to D7) or using the most significant 4 bits of the data bus (D4 to D7).

lcd buss

Ccs compiler program
#include <18f4550 .h = »»> // we include the pic to use
#fuses hs, nowdt, noprotect, nolvp // fuses
#use delay (clock = 20000000) // 20Mhz quartz crystal
#include <lcd .c = »»> // we include the lcd library

void main () // main function
{
delay_ms (25);
lcd_init (); // we start the