Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Moved] For EEPROM programming how PIC16F877A is connected

Status
Not open for further replies.

bikash123

Member level 2
Joined
Feb 19, 2012
Messages
48
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Tezpur University
Activity points
1,672

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
void WriteEEPROM(char Addr, char Data);
char ReadEEPROM(char addr);
void port_confg();
 Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);               // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
 
 void main()
{
 char WriteEEPROM(char Addr, char Data);
  char ReadEEPROM(char addr);
 
  port_confg();
  Delay_ms(2000);
 
   while(1)
     {
     }
  }
  
 void port_confg()
 {
 PORTB = 0;
 PORTA = 0;
 TRISB = 0b00001111;
 TRISA = 0b00100000;
 }
 
  
char WriteEEPROM(char Addr, char Data)
{
while(EECON1.WR == 1);
EEADR = Addr;
EEDATA = Data;
EECON1.EEPGD = 0;              // 0 = Access data EEPROM memory
EECON1.WREN = 1;                // enable writes to internal EEPROM
EECON2 = 0x55;                  // Required sequence for write to internal EEPROM
EECON2 = 0xAA;                     // Required sequence for write to internal EEPROM
EECON1.WR = 1;                    // begin write to internal EEPROM
EECON1.WREN = 0;  
 
}
char ReadEEPROM(char addr)
{
EEADR = addr;
EECON1.EEPGD = 0;
EECON1.RD = 1;
asm nop; asm nop;
return EEDATA;
}

 
Last edited by a moderator:

Re: For EEPROM programming how PIC16F877A is connected

I do not understand what you are asking - do you want to program an external EEPROM, or the internal one? This code is for the internal EEPROM. What do you want to know how to connect?

P.s. please use CODE tags when posting code. That is the '#' symbol on the message toolbar.
 
Re: For EEPROM programming how PIC16F877A is connected

Yes, i would like to know how Microcntroller connect with LCD, so that EEPROM will display it.
 

The connections are in the code, assuming you are using an HD44780 compatible LCD. Lines 2 to 7 in the code, with the LCD being connected to the pins on port B as listed.

See also here for basic info and pinout on HD44780 LCD's: https://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller

Note also that since the LCD RW pin is not defined, that pin on the LCD (pin 5) should be connected to ground to fix the LCD in write mode.

Pin 3 on the LCD (the contrast pin) is connected to the wiper of a 10k or higher potentiometer/preset, with the ends of the potentiometer connected between ground and +5V. That potentiometer is adjusted to get a display on the LCD.
 

but sir, why does lcd has not displayed it. i have connected it as per the references of microc. but the problem is i am unable to solve it before three days. where is the problem. I have connected AN2 as input by a potentio
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top