Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/20/05 16:50
Read: times


 
#95379 - for those of you who need this
Responding to: ???'s previous message
Some chips have "straight forward" write capabilities re writing flash. So, if you need that, use such a chip.

here is an example for using the top 64k (of 128) of a SILabs f126 for permanent data storage (erased sector is a prerequisite):
void WriteFlash (U8 xdata * WFSaddr, U8 WFCdata)
{
U8 WFCintsav;

  WFCintsav = SG_IE;
  SG_IE = 0;
  SG_SFRPAGE = 0x0f;
  SF_CCH0CN &= 0xfe;    // single byte write
  SG_SFRPAGE = 0;
  if (WFSaddr > 0x7fff)
  {
    SG_PSBANK = 0x30; 
  }
  else
  {
    SG_PSBANK = 0x20; 
    WFSaddr   += 0x8000   ;
  }
  S0_FLSCL  |= 0x01     ; // flash write
  S0_PSCTL  |= 0x01     ; // movx to flash      
  *WFSaddr   =  WFCdata ; //write the byte
  S0_PSCTL  &= 0xfe     ; // restore     
  S0_FLSCL  &= 0xfe     ; // restore
  SG_PSBANK = 0x10      ;
  SG_IE = WFCintsav;  
}


Erik

List of 42 messages in thread
TopicAuthorDate
IAP Problem in AT89C51RD2            01/01/70 00:00      
   IAP PROBLEM            01/01/70 00:00      
      misinterpretations            01/01/70 00:00      
   IAP source            01/01/70 00:00      
      IAP source?            01/01/70 00:00      
         ..xC51x.. IAP API            01/01/70 00:00      
            oh those...            01/01/70 00:00      
               IAP            01/01/70 00:00      
                  sorry...            01/01/70 00:00      
                  IAP            01/01/70 00:00      
               Yes, but..            01/01/70 00:00      
                  bootloader            01/01/70 00:00      
                     Depressing, isn't it?            01/01/70 00:00      
                        complaining to Atmel?            01/01/70 00:00      
                           please, WHAT is the problem            01/01/70 00:00      
                              Not at all...            01/01/70 00:00      
                                 comments            01/01/70 00:00      
                                    More comments            01/01/70 00:00      
                                       comments on more comments            01/01/70 00:00      
                                          other way 'round (a pinch of irony)            01/01/70 00:00      
                                             keep it going            01/01/70 00:00      
                                                What's the point?            01/01/70 00:00      
                                          COMCOMC            01/01/70 00:00      
                                             for those of you who need this            01/01/70 00:00      
                                                straighforward?            01/01/70 00:00      
   Interrupts            01/01/70 00:00      
      The coments are in spanish if you are in            01/01/70 00:00      
         Translation?            01/01/70 00:00      
            The code            01/01/70 00:00      
   IAP on Atmel            01/01/70 00:00      
      only 16 bytes?            01/01/70 00:00      
         don't know            01/01/70 00:00      
            that might be the explanation            01/01/70 00:00      
      Are you overwriting your own code? Where            01/01/70 00:00      
         code example            01/01/70 00:00      
            IAP Problem            01/01/70 00:00      
            My Code            01/01/70 00:00      
               This looks good...            01/01/70 00:00      
   Thank U for the Great support            01/01/70 00:00      
      I see many and no U            01/01/70 00:00      
      And what was the problem???            01/01/70 00:00      
         Not Yet            01/01/70 00:00      

Back to Subject List