vendredi 22 janvier 2016

How to controle LCD widh Pic 16f877

Share it Please




How to controle LCD widh Pic 16f877




Introduction


The most commonly used Character based LCDs are based on Hitachi's HD44780 controller or other which are compatible with HD44580. In this tutorial, we will discuss about character based LCDs, their interfacing with various microcontrollers, various interfaces (8-bit/4-bit), programming, special stuff and tricks you can do with these simple looking LCDs which can give a new look to your application.

For Specs and technical information HD44780 controlle



Pin Description

The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support at most of 80 charachers, whereas LCDs supporting more than 80 characters make use of 2 HD44780 controllers.

Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins are extra in both for back-light LED connections). Pin description is shown in the table below
Pin No.NameDescription
1D7Data bus line 7 (MSB)
2D6Data bus line 6
3D5Data bus line 5
4D4Data bus line 4
5D3Data bus line 3
6D2Data bus line 2
7D1Data bus line 1
8D0Data bus line 0 (LSB)
9EN1Enable signal for row 0 and 1 (1stcontroller)
10R/W0 = Write to LCD module
1 = Read from LCD module
11RS0 = Instruction input
1 = Data input
12VEEContrast adjust
13VSSPower supply (GND)
14VCCPower supply (+5V)
15EN2Enable signal for row 2 and 3 (2ndcontroller)
16NCNot Connected
Table 2: Character LCD pins with 2 Controller



simulation :






programmation :

#include <16F877.h>
#device adc=10
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)                                           
#include "LCD.c"                                                                         

#define LCD_ENABLE_PIN  PIN_B0                                    ////
#define LCD_RS_PIN      PIN_B1                                    ////
#define LCD_RW_PIN      PIN_B2                                    ////
#define LCD_DATA4       PIN_B4                                    ////
#define LCD_DATA5       PIN_B5                                    ////
#define LCD_DATA6       PIN_B6                                    ////
#define LCD_DATA7       PIN_B7                                       

void main() {                                                                 

lcd_init(); 

while(1){                          // boucle infinie
lcd_gotoxy(1,1);
printf(lcd_putc,"Smart_Tech Naim");   //Ecrire sur l'ecran lcd 
  lcd_gotoxy(1,2);
printf(lcd_putc,"smart-tech-med-naim");
  
}                       
}





Aucun commentaire:

Enregistrer un commentaire