IS31IO8972 EVB user guide
SPIDATA = mask;
while ((SPIST & 0x80) == 0x00){}; SPIST &= 0x7F; // wait and clear SSPIF
SPIDATA = din;
while ((SPIST & 0x80) == 0x00){}; SPIST &= 0x7F; // wait and clear SSPIF
P7
|= 0x04; // P72: SCS high
for (i=0;i<0xFF;i++)
{
_nop_();
}
}
//------------------------------------------------------------------------------
// write one byte
void SPI_write_1(uchar addr, uchar din)
{
uchar i;
SPIMR |= 0x20; // clear FIFO
SPIMR &= 0xDF;
SPIST &= 0x7F; // clear SSPIF
P7
&= 0xFB; // P72: SCS low
SPIDATA = 0x22; // "write" instruction
while ((SPIST & 0x80) == 0x00){}; SPIST &= 0x7F; // wait and clear SSPIF
SPIDATA = addr;
while ((SPIST & 0x80) == 0x00){}; SPIST &= 0x7F; // wait and clear SSPIF
SPIDATA = din;
while ((SPIST & 0x80) == 0x00){}; SPIST &= 0x7F; // wait and clear SSPIF
P7
|= 0x04; // P72: SCS high
for (i=0;i<0xFF;i++)
{
_nop_();
}
}
//------------------------------------------------------------------------------
// write n bytes to remomte_addr
void SPI_write_n(uchar remote_addr, uchar n, uchar* local_data)
{
uchar i;
SPIMR |= 0x20; // clear FIFO
SPIMR &= 0xDF;
SPIST &= 0x7F; // clear SSPIF
P7
&= 0xFB; // P72: SCS low
SPIDATA = 0x22; // "write" instruction
while ((SPIST & 0x80) == 0x00){}; SPIST &= 0x7F; // wait and clear SSPIF
SPIDATA = remote_addr; // remote starting address
while ((SPIST & 0x80) == 0x00){}; SPIST &= 0x7F; // wait and clear SSPIF
while (n>0x00)
{
SPIDATA = *local_data;
while ((SPIST & 0x80) == 0x00){}; SPIST &= 0x7F; // wait and clear SSPIF
local_data++;
n--;
}
P7
|= 0x04; // P72: SCS high
for (i=0;i<0xFF;i++)
{
_nop_();
}
}
Integrated Silicon Solution, Inc. – www.issi.com
Rev. A, 14/03/2019
12
Need help?
Do you have a question about the IS31IO8972 EVB and is the answer not in the manual?
Questions and answers