How to controle LCD widh Pic 16f877
Introduction
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. | Name | Description |
---|---|---|
1 | D7 | Data bus line 7 (MSB) |
2 | D6 | Data bus line 6 |
3 | D5 | Data bus line 5 |
4 | D4 | Data bus line 4 |
5 | D3 | Data bus line 3 |
6 | D2 | Data bus line 2 |
7 | D1 | Data bus line 1 |
8 | D0 | Data bus line 0 (LSB) |
9 | EN1 | Enable signal for row 0 and 1 (1stcontroller) |
10 | R/W | 0 = Write to LCD module 1 = Read from LCD module |
11 | RS | 0 = Instruction input 1 = Data input |
12 | VEE | Contrast adjust |
13 | VSS | Power supply (GND) |
14 | VCC | Power supply (+5V) |
15 | EN2 | Enable signal for row 2 and 3 (2ndcontroller) |
16 | NC | Not 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