|
下面的程序,只能写BANK0,怎么写BANK1 BANK2 BANK3呢?
另外,PDF写从RAM FLASH擦出,再程序怎么实现啊,搞不懂
//***************************************************************************//
// //
//函数:void ERASE(unsigned int) //
//说明:擦除片内FLASH数据段 //
//参数:address ——擦除数据段地址 //
// //
//***************************************************************************//
void FERASE(unsigned int address)
{
unsigned int *Erase_address ;
Erase_address = (unsigned int *)address ;
FCTL1 = FWKEY + ERASE ;
FCTL3 = FWKEY ;
*Erase_address = 0 ;
FCTL1 = FWKEY ;
FCTL3 = FWKEY + LOCK ;
}
//***************************************************************************//
// //
//函数:void ERASE(unsigned int) //
//说明:擦除片内FLASH数据 //
//参数:address ——擦除起始地址 //
// //
//***************************************************************************//
void FWRITE(unsigned int address, unsigned char* data,unsigned int length)
{
unsigned int i ;
unsigned char* Wr_Addr ;
Wr_Addr =(unsigned char*)address ;
FCTL1 = FWKEY + WRT ; // Set WRT bit for write operation
FCTL3 = FWKEY ;
for(i=0;i<length;i++)
{
*Wr_Addr= data ;
Wr_Addr++ ;
}
FCTL1 = FWKEY ;
FCTL3 = FWKEY + LOCK ;
} |
阿莫论坛20周年了!感谢大家的支持与爱护!!
一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。
|