| ??? 11/05/08 08:01 Read: times | #159700 - reding flash Responding to: ???'s previous message | 
| Hello,
 unsigned char xdata * idata pwrite; // pointer to FLASH used for writes // NOTE: this pointer must be located // in <data> or <idata> space! unsigned char code *pread; // pointer to FLASH used for reads // test string stored in FLASH unsigned char code test_string[] = "Howdy!"; ... while (*pread != ' ') { // copy until NULL is detected *pwrite = *pread; // copy byte pread++; // advance pointers pwrite++; } *pwrite = ' '; Read pointer not in xdata and not pointing to xdata, so it should be ok. This part of code is for writing into flash memory and that's working but this part of code : 
// 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 != ' ') {            // copy until NULL is detected
      *pwrite = *pread;                // copy byte
      pread++;                         // advance pointers
      pwrite++;
   }
   *pwrite = ' ';
   PSCTL = 0x00;                       // MOVX writes target XRAM
   
   FLSCL &= ~0x01;                     // disable FLASH writes/erases from
                                       // user software   
   EA = EA_save;                       // re-enable interrupts
 don't working. It's for reading values in the flash memory and store it in an array (eedata for me). Thanks Regards | 




