bonjour,
voilà un programme que j'ai trouvé pour écrire dans l'EEPROM, le probleme c'est qu'il est censé copier un tableau de 16 cases la RAM dans l'EEPROM, mais il ne recopie que la première case qui a comme valeur AAAA
pouvez vs m'aider à trouvé la faute commise dans le programme ?
#include "../../EEPROM.X/h/DataEEPROM.h"
#include "../../EEPROM.X/h/p30F4011.h"
_FOSC(CSW_FSCM_OFF & XT_PLL8); /* Set up for XTxPLL8 mode since */
/* we will be tuning the FRC in this example */
_FWDT(WDT_OFF); /* Turn off the Watch-Dog Timer. */
_FBORPOR(MCLR_EN & PWRT_OFF); /* Enable MCLR reset pin and turn off the power-up timers. */
_FGS(CODE_PROT_OFF); /* Disable Code Protection */
/*Declare constants/coefficients/calibration data to be stored in DataEEPROM*/
int _EEDATA(32) fooArrayInDataEE[] = {0,1,2,3,4,5,6,7,8,9,0xA,0xB,0 xC,0xD,0xE,0xF};
/*Declare variables to be stored in RAM*/
int fooArray1inRAM[] = {0xAAAA, 0xBBBB, 0xCCCC, 0xDDDD, 0xEEEE, 0xFFFF, 0xABCD, 0xBCDE, 0xCDEF, 0xDEFA, 0x0000, 0x1111, 0x2222, 0x3333, 0x4444, 0x5555};
int fooArray2inRAM[16];
int main(void);
void _ISR _DefaultInterrupt(void);
int main(void)
{
int temp = 0;
/*Read array named "fooArrayinDataEE" from DataEEPROM and place the result into*/
/*array in RAM named, "fooArray2inRAM" */
temp = ReadEE(__builtin_tblpage(&fooA rrayInDataEE[0]),__builtin_tbloffset(&fooArra yInDataEE[0]),&fooArray2inRAM[0], ROW);
/*Erase 16 words (1 row in dsPIC30F DataEEPROM) in Data EEPROM from array named "fooArrayinDataEE" */
temp = EraseEE(__builtin_tblpage(&foo ArrayInDataEE[0]), __builtin_tbloffset(&fooArrayI nDataEE[0]), ROW);
/*Write 16 words (1 row in dsPIC30F DataEEPROM) to Data EEPROM from array named "fooArray1inRAM" */
/*to array named "fooArrayinDataEE" */
temp = WriteEE(&fooArray1inRAM[0],__builtin_tblpage(&fooArrayIn DataEE[0]),__builtin_tbloffset(&fooArra yInDataEE[0]), ROW);
while(1);/* Place a breakpoint here, run code and refresh the DataEEPROM window in MPLAB IDE */
}
void __attribute__((interrupt, no_auto_psv)) _DefaultInterrupt(void)
{
while(1) ClrWdt()
}
Merci
-----