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. :)
I am not sure how you are going to maintain code that you didn't write or don't understand. The driver starts with the serial command and address then switches to the user address by a counter in the interrupt routine.
typedef enum { WRSR = 0x0100, /* Write Status Register */ WRITE = 0x0200, /* Write Data to Memory Array */ READ = 0x0300, /* Read Data from Memory Array */ WRDI = 0x0400, /* Reset Write Enable Latch */ RDSR = 0x0500, /* Read Status Register */ WREN = 0x0600, /* Set Write Enable Latch */ } EepromCommandType;
_inline void EepromStartTx(void) { 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 */ }
What you have said, I understand it. What I don't know to do is how to modify the pointer to change the writing/reading start adress that I want.