FM25L16
铁电存储器与F020读写
unsigned char SpiReadWrite(unsigned char c)
{
SPIF = 0;
SPI0DAT = c;
while (SPIF == 0);
return SPI0DAT;
}
/*
unsigned char FMRead(unsigned int addr)
{
unsigned char b;
fm0();
_nop_();
_nop_();
_nop_();
_nop_();
SpiReadWrite(EE_READ);
SpiReadWrite(addr >> 8);
SpiReadWrite(addr & 0xff);
b = SpiReadWrite(0);
_nop_();
_nop_();
fm1();
_nop_();
_nop_();
return b;
}
void FMWrite(unsigned int addr, unsigned char b)
{
fm0();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
SpiReadWrite(EE_WREN);
_nop_();
_nop_();
_nop_();
fm1();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
fm0();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
SpiReadWrite(EE_WRITE);
SpiReadWrite(addr >> 8);
SpiReadWrite(addr & 0xff);
SpiReadWrite(b);
_nop_();
_nop_();
fm1();
_nop_();
_nop_();
}
*/
void FMReadPage(unsigned int addr, unsigned char * index, unsigned char n)
{
unsigned char i;
fm0();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
SpiReadWrite(EE_READ);
SpiReadWrite(addr >> 8);
SpiReadWrite(addr & 0xff);
for(i=0;i> 8);
SpiReadWrite(addr & 0xff);
for(i=0;i
2021-09-13 11:18:57
2KB
铁电存储器
1