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.

Program for reading/writing to serial eeprom

Status
Not open for further replies.

hassan1980

Full Member level 4
Joined
Jan 14, 2005
Messages
204
Helped
9
Reputation
18
Reaction score
6
Trophy points
1,298
Activity points
1,340
Serial Eeprom

I want an asm program for reading and writing to serial eeprom for example 24C64 and pic 16F84.
 

Re: Serial Eeprom

hi...

i'm beginner in pic world ...but i'm going to build data logger project...

my idea is to use PIC16F88 that have i2c...compare to the F84..

my question is..is there any subroutine to read and write a data to/from external eeprom such 24L64?

thanks in advance
 

    hassan1980

    Points: 2
    Helpful Answer Positive Rating
Re: Serial Eeprom

Hi,

here is the code in C on how to Read and Write to the internal eeprom of the PIC:
*****************************************************
void my_eeprom_write (char addr, char value)
{

while(WR)
continue;
EEADR=(addr);
EEDATA=(value);
EECON1&=0x7F;
CARRY=0;
if(GIE)
CARRY=1;
GIE=0;
WREN=1;
EECON2=0x55;
EECON2=0xAA;
WR=1;
asm("nop");
asm("nop");
if(CARRY)
GIE=1;
WREN=0;

}
**************************************************
/*********************************************************************
* EEPROM_READ_Function *
*********************************************************************/
unsigned char my_eeprom_read (char addr)
{
while(WR)
continue;
EEADR=addr;
EECON1&=0x7F;
RD=1;
//EEDATA;
return(EEDATA);
}
***************************************************************

For external use the I2C.
 
  • Like
Reactions: fenster

    hassan1980

    Points: 2
    Helpful Answer Positive Rating

    fenster

    Points: 2
    Helpful Answer Positive Rating
Re: Serial Eeprom

thanks a lot...

but the thing is...i try to run using assembly..

anybody...

one more thing..software routine i2c is more stable than hardware i2c?..

thanks in advance
 

Re: Serial Eeprom

Hi,

1. I made the code into assambly for the PIC16F88. attached is the complete output from the debuger in asm. you will have to retrive the code from there.

software routine i2c is more stable than hardware i2c
Hardware is alswys more stable then software, aslo the hardware gives you more time to use the MCU then spend it on unwanted things.

Good luck.
 

Re: Serial Eeprom

thanks..

but if i'm not mistake..this on efor internal eeprom..

i'm looking to the interface with external eeprom using internal hardware approach..like pi16f88 with 24LC512

thanks in advance
 

Serial Eeprom

Hi,

Well if you are using 24LC512 Then you must be using I2C. So, what you need is the I2C protocol.
To find out more how to do that go to:
www.microchipc.com
Good luck.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top