100% found this document useful (1 vote)
65 views1 page

Giovanni

The document describes the initialization of an LCD display and use of EEPROM memory on a PIC16F877A microcontroller. It defines the LCD pin connections and configuration, writes a message from RAM to EEPROM memory locations, reads the message back from EEPROM and displays it on the LCD. It then repeats this read/write process in a continuous loop.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
65 views1 page

Giovanni

The document describes the initialization of an LCD display and use of EEPROM memory on a PIC16F877A microcontroller. It defines the LCD pin connections and configuration, writes a message from RAM to EEPROM memory locations, reads the message back from EEPROM and displays it on the LCD. It then repeats this read/write process in a continuous loop.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Giovanni Coaquira

//Pines de salida para el LCD


sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D4 at RB0_bit;
//Bits de configuracin TRIS
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D7_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB0_bit;

char mensaje[] = "ComaTEC-MicroPIC";
char Edata[] = "0000000000000000";

unsigned short i ;
unsigned int ADD; // Start EEPROM
char temp;

unsigned int cc=0;
char texto[16];

void main() {
TRISD=1;
PORTD=0;
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear LCD
Lcd_Cmd(_LCD_CURSOR_OFF); // Turn cursor off
Lcd_Out(1, 1, "Ejemplo de EEPROM");
Lcd_Cmd(_LCD_CLEAR);
do{
// Write Operation
ADD = 0;
for (i=0; i<16; i++) {
temp = mensaje[i];
EEPROM_Write(ADD+i,temp);
}
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Escrito...");
Delay_ms(2000);
// Read Operation
Lcd_Cmd(_LCD_CLEAR);
ADD = 0;
for (i=0; i<16; i++) {
temp = EEPROM_Read(ADD+i);
Edata[i] = temp;
}
Lcd_Out(2,1,Edata);
Delay_ms(2000);
} while(1);
}


D
7
1
4
D
6
1
3
D
5
1
2
D
4
1
1
D
3
1
0
D
2
9
D
1
8
D
0
7
E
6
R
W
5
R
S
4
V
S
S
1
V
D
D
2
V
E
E
3
LCD1
LM016L
5
6
%
RV1
5k
X1
CRYSTAL
C1
22p
C2
22p
RA0/AN0
2
RA1/AN1
3
RA2/AN2/VREF-/CVREF
4
RA4/T0CKI/C1OUT
6
RA5/AN4/SS/C2OUT
7
RE0/AN5/RD
8
RE1/AN6/WR
9
RE2/AN7/CS
10
OSC1/CLKIN
13
OSC2/CLKOUT
14
RC1/T1OSI/CCP2
16
RC2/CCP1
17
RC3/SCK/SCL
18
RD0/PSP0
19
RD1/PSP1
20
RB7/PGD
40
RB6/PGC
39
RB5
38
RB4
37
RB3/PGM
36
RB2
35
RB1
34
RB0/INT
33
RD7/PSP7
30
RD6/PSP6
29
RD5/PSP5
28
RD4/PSP4
27
RD3/PSP3
22
RD2/PSP2
21
RC7/RX/DT
26
RC6/TX/CK
25
RC5/SDO
24
RC4/SDI/SDA
23
RA3/AN3/VREF+
5
RC0/T1OSO/T1CKI
15
MCLR/Vpp/THV
1
U2
PIC16F877A
R1
10k

You might also like