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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/08/06 18:31
Read: times


 
#115813 - I can't help you
Responding to: ???'s previous message
$include (C:\Keil\C51\ASM\C8051F350.INC)

I can't help you with a deviate, but a few things that apply to the derivatives may also apply to the deviates

here is working code for a f12/f13x
////////////////////////////////////////////////////////////
//
//
// FUNCTION void EraseFlash (void)
//
// erase flash page
//

void EraseFlash (void)
{
U8 xdata *  EFLpag = 0;
U8          EFLbnk = 0;

  for ( EFLbnk = 2 ; EFLbnk != 4 ; EFLbnk++)
  {
    for (EFLpag = 0;  EFLpag != 0x8000;   EFLpag = EFLpag + 1024)
    {
      EraseFlashPage (EFLpag, EFLbnk);
    }
  }
}




////////////////////////////////////////////////////////////
//
//
// FUNCTION void EraseFlashPage (U8 xdata * EFLpage, U8 EFLbank)
//
// erase flash page
//

void EraseFlashPage (U8 xdata * EFLpage, U8 EFLbank)
{
U8 EFPintsav;

  EFLpage += 0x8000;

  EFPintsav   = SG_IE;
  SG_IE = 0;
  SG_SFRPAGE  = 0;
  SG_PSBANK   = (EFLbank << 4); 
  S0_FLSCL   |= 0x01     ; // flash access
  S0_PSCTL   |= 0x02     ; // erase flash      
  S0_PSCTL   |= 0x01     ; // erase flash      
  *EFLpage    =  0xff    ; //write a byte as page indicator
  S0_PSCTL   &= 0xfc     ; // restore     
  S0_FLSCL   &= 0xfe     ; // restore
  SG_PSBANK   = 0x10      ;
  SG_IE = EFPintsav;  
}
Erik

List of 18 messages in thread
TopicAuthorDate
Silab - Erasing and writing to Flash Fro            01/01/70 00:00      
   Posting Screenshot            01/01/70 00:00      
   If you use interrupts?            01/01/70 00:00      
      This is test software            01/01/70 00:00      
   common courtesy require ...            01/01/70 00:00      
      You are right here also Erik            01/01/70 00:00      
   I can't help you            01/01/70 00:00      
      Thanks Erik            01/01/70 00:00      
   Any flash pages locked?            01/01/70 00:00      
      Locked Page            01/01/70 00:00      
         Section 15.3 of Data Sheet            01/01/70 00:00      
   Key codes            01/01/70 00:00      
      Not my choise            01/01/70 00:00      
         Choices ...            01/01/70 00:00      
      You are right Rob            01/01/70 00:00      
      a General comment            01/01/70 00:00      
   131 & 133            01/01/70 00:00      
      but remember            01/01/70 00:00      

Back to Subject List