MSP430高手看一下5418片内FLASH怎么写BANK1,有程序
下面的程序,只能写BANK0,怎么写BANK1 BANK2 BANK3呢?另外,PDF写从RAM FLASH擦出,再程序怎么实现啊,搞不懂
//***************************************************************************//
// //
//函数:void ERASE(unsigned int) //
//说明:擦除片内FLASH数据段 //
//参数:address ——擦除数据段地址 //
// //
//***************************************************************************//
void FERASE(unsignedint 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(unsignedint 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 ;
} 只写过在inforA,B里面 这个是编译器设置问题,设置为大编译模式,所有的FLASH空间都可以读写。
页:
[1]