bool Read_Data(unsigned char *buffer, unsigned int long eeprom_address, unsigned char size)
{
unsigned char i;
while(FSTAT_CCIF == 0); //wait if command in progress
for(i=0;i<size;i++)
{
*(buffer + i) = *(unsigned int * ) eeprom_address;
eeprom_address = (eeprom_address + 1);
}
} /* Read_Data */
while calling this function it is not updating the first byte read in buffer and but other data is available.
Eg;
unsigned char data[10];
unsigned char *buffer=data;
unsigned int arr[]={0X11AA,0X2222,0X3333,0X4444,0X5555};
this i wrote on EEPROM on address 0x100000 to 0x100009
so in data there is no first byte available
it is data[]={0XAA,0X22,0X22,0X33,0X33,0X44,0X44,0X55,0X55};
Hi,
“on address 0x100000 to 0x100009”
“data[]={0XAA,0X22,0X22,0X33,0X33,0X44,0X44,0X55,0X55};”
I see just nine numbers. Data should contain also value from address 0x100009?
You combined data types – you wrote int into char.
Could you please use
*(buffer + i) = *(unsigned char * ) eeprom_address;
Instead of
*(buffer + i) = *(unsigned int * ) eeprom_address;
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------