| ??? 11/04/08 14:38 Read: times |
#159641 - answers Responding to: ???'s previous message |
Hello,
Per Westermark said: What did you test in your IDE. Or what code did you test in your IDE? quote]
// PART A -- erase the FLASH page at 0x1000
// initialize write/erase pointer
pwrite = (unsigned char xdata *) 0x1000;
EA_save = EA; // save interrupt status
EA = 0; // disable interrupts (precautionary)
FLSCL |= 0x01; // enable FLASH writes/erases from
// user software
PSCTL = 0x03; // MOVX writes erase FLASH page
*pwrite = 0; // initiate page erase
PSCTL = 0; // MOVX writes target XRAM
FLSCL &= ~0x01; // disable FLASH writes/erases from
// user software
EA = EA_save; // re-enable interrupts
// PART B -- copy test string to FLASH memory at address 0x1000
// initialize FLASH read pointer
pread = (unsigned char code *) test_string;
EA_save = EA; // save interrupt status
EA = 0; // disable interrupts (precautionary)
pwrite = 0x1000; // initialize FLASH write pointer
FLSCL |= 0x01; // enable FLASH writes/erases from
// user software
PSCTL = 0x01; // MOVX writes target FLASH memory
while (*pread != '\0') { // copy until NULL is detected
*pwrite = *pread; // copy byte
pread++; // advance pointers
pwrite++;
}
*pwrite = '\0';
PSCTL = 0x00; // MOVX writes target XRAM
FLSCL &= ~0x01; // disable FLASH writes/erases from
// user software
EA = EA_save; // re-enable interrupts
and
while (1) // spin forever
{
for (ii=0;ii<6; ii++)
{
LED = 1;
printf("%c",eedata[ii]);
printf("@13");
}
printf("\x0d");
printf("\x0a");
LED = 0;
}
and this don't work because nothing is send by uart
// PART C -- read test string to FLASH memory at address 0x1000 and copy in tab eedata
EA_save = EA;
EA = 0;
pwrite = 0x1000;
FLSCL |= 0x40;
PSCTL = 0x00;
while (*pread !='\0') {
*eedata = *pread; // copy byte
pread++; // advance pointers
pwrite++;
}
PSCTL = 0x00; // MOVX writes target XRAM
FLSCL &= ~0x40; // disable FLASH writes/erases from
// user software
EA = EA_save; // re-enable interrupts
Per Westermark said:
Where did you - in your IDE - see the copying of data into the eedata[] array? I don't know that. By the uart, i see no value and i suppose that my code for the reading flash memory don't work.
// PART C -- read test string to FLASH memory at address 0x1000 and copy in tab eedata
EA_save = EA;
EA = 0;
pwrite = 0x1000;
FLSCL |= 0x40;
PSCTL = 0x00;
while (*pread !='\0') {
*eedata = *pread; // copy byte
pread++; // advance pointers
pwrite++;
}
PSCTL = 0x00; // MOVX writes target XRAM
FLSCL &= ~0x40; // disable FLASH writes/erases from
// user software
EA = EA_save; // re-enable interrupts
I hope this answers your questions Thanks. Regards |



