We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello. I need some help. I'm trying to write, read and erase an external EEPROM (25AA040 MICROCHIP) via SPI from XC164CS board, for example, one byte at 0x00 adress of the eeprom, but i don't know how to do it. Into the datasheet, I can see some instructions but i don't know what to do with them: img28.imagevenue.com/img.php Could anyone help me? Thank you very much. :)
didn't you say that 'EepromStartTx' cannot be changed without disabling your EEPROM? let me ask again: post the modified version of it, and only that function, that does not work. that is the source of the problem, isn't it (at least, according to you)?
In opinion of Chris, only the enum EepromCommandType must be changed (I have already changed it) and modify the start address of pointer, but i don't know how to do it. This is the modified version by me.
_inline void EepromStartTx(U16 MY_ADRESS) { CS_EEPROM = low; eeprom.bytesTx = 1; /* decrement the transmit count by one */ eeprom.bytesRx = 0; eeprom.txptr = (S8 *)(&eeprom)+MY_ADRESS; /* reset pointer to first element */ SSC0_TB = *eeprom.txptr++; /* write the first byte to the SSC0 tx buffer */ }
Hello, Tamir, Chris, my nigthmare has ended. I have tested the last configuration of Chris, and the program works perfectly. I read /write the bytes in the wished address. It isn't necessary to add a new parameter in the EepromStartTx function. Only the pointer has to be increased by 1.
_inline void EepromStartTx() { CS_EEPROM = low; eeprom.bytesTx = 1; /* decrement the transmit count by one */ eeprom.bytesRx = 0; eeprom.txptr = (S8 *)(&eeprom) + 1; /* reset pointer to first element */ SSC0_TB = *eeprom.txptr++; /* write the first byte to the SSC0 tx buffer */ }
Thanks very much for your help.