I am using the MCP79511 rtc time set or read using the same read/write functions are working correct. however; writing the EEprom seems to fail.
Reading ID is working when activated and eeread dis-activated.
I did try to follow the manual. (page 10/ 37/40)
http://ww1.microchip.com/downloads/...CP7952X-Battery-Backed-SPI-RTCC-20002300C.pdf
What do I wrong or it's just a reading problem?
Picbuster
Moderators note : used code tags for C
Reading ID is working when activated and eeread dis-activated.
I did try to follow the manual. (page 10/ 37/40)
http://ww1.microchip.com/downloads/...CP7952X-Battery-Backed-SPI-RTCC-20002300C.pdf
What do I wrong or it's just a reading problem?
Picbuster
C:
// delays added to make measurement easier.
// test mcp79511 eeprom
//================ read ======================
RTC_Ena=Low;
__delay_ms(1);
WriteSPI2(0b00000011); // EEread
// WriteSPI2( 0b00110011); // read ID 7 working
WriteSPI2(0);
for (int i=0 ;i < 7;i++)
{
int a = ReadSPI2();
printf("%d ",a);
}
printf("\r\n");
RTC_Ena=High;
// ========================= end read =========================
__delay_ms(30);
// =============== write ========================
// ------------ set EEwren conform manual ---------------------------------
RTC_Ena=Low;
__delay_ms(1);
WriteSPI2(0x00000110); // EEwren
RTC_Ena=High;
//---------------------------------------------------------------------------
__delay_ms(1);
RTC_Ena=Low;
WriteSPI2(0b00000010); // EEwrite mode
//------------------------------------------------------------------------------
WriteSPI2(0x0); // start address
WriteSPI2(0b00100000); // just 4 bytes of data
WriteSPI2(0b00100001);
WriteSPI2(0b00100010);
WriteSPI2(0b00100011);
//------------------------------------------------------------------------------
__delay_ms(1);
RTC_Ena=High;
//================= end write =======================
Last edited by a moderator: