void writeFlash(u8 *ram_add,u16 page_add,u16 page_offset,u16 len)
{
u16 i;
u8 dat;
// gsb_CS = 0;
Disable45db161();
writeByte_SPI(0x84);//读缓冲器1
writeByte_SPI(0x00);
writeByte_SPI((u8)(page_offset> > 8));// 页内偏移BA9-BA8
writeByte_SPI((u8)(page_offset)) ; // 页内偏移BA7-BA0
for(i=0;i <len;i++)
{
dat = ram_add[i];
writeByte_SPI(dat);
}
// gsb_CS = 1;
Enable45db161();
Disable45db161();
// gsb_CS = 0;
writeByte_SPI(0x83);//察除缓冲器1
writeByte_SPI((u8)(page_add> > 6));
writeByte_SPI((u8)((page_add < <2)+(page_offset> > 8)));
writeByte_SPI(0x00) ;
// gsb_CS = 1;
Enable45db161();
delay_DelayMs(400);
}