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.

[SOLVED] I2C in PCW for PIC16f877A

Status
Not open for further replies.

vishy71

Full Member level 2
Full Member level 2
Joined
Dec 16, 2010
Messages
126
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Iran
www.korosh-life.blogfa.com
Activity points
2,296
Hi

I wanna use AT24C1024 in my project.but I can't understand what I must to do!
I am also programming with PICC PCW
I am using PIC16F877A.

can you help me please?


thanks
 

You have few several ways to solve your problem:
- Use SPI eeprom (25xxxx) 25C1024 for example
- Use software SPI
- Use software I2c
- Find a different mcu
- Forget about it
This chip can't share hardware i2c and spi at one time.
 
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Code:
void EEPROM24_Write_Byte (char i2c_adrs, unsigned int adrs, char dat)
{
 I2C1_Start();
 I2C1_Wr(i2c_adrs&0xFE);
 I2C1_Wr((adrs&0xFF00)>>8);
 I2C1_Wr(adrs&0xFF);
 I2C1_Wr(dat);
 I2C1_Stop();
 delay_ms(EEPROM_Write_Delay_ms);
}

void EEPROM24_Read_Byte (char i2c_adrs, unsigned int adrs, char *eeprom_dat)
{
   I2C1_Start();
   I2C1_Wr(i2c_adrs&0xFE);
   I2C1_Wr((adrs&0xFF00)>>8);
   I2C1_Wr(adrs&0xFF);
   I2C1_Repeated_Start();
   I2C1_Wr(i2c_adrs|0x01);
   *eeprom_dat=I2C1_Rd(0);
   I2C1_Stop();
}
 
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top