我用过没问题啊//--------------------------------
//Erase all data on chip
//--------------------------------
void chip_erase( void )
{
SFRPAGE = 0x0F ;
CE_H() ;
WE_H() ;
OE_H() ;
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( 0xAAA, 0x80 );
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( 0xAAA, 0x10 );
wait_ready1();
}
//--------------------------
//Erase a sector
//--------------------------
void sec_erase( ulong addre )
{
SFRPAGE = 0x0F ;
CE_H() ;
WE_H() ;
OE_H() ;
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( 0xAAA, 0x80 );
out_byte( 0xAAA, 0xAA );
out_byte( 0x555, 0x55 );
out_byte( addre, 0x30 );
wait_ready2();
}
|