SPI主模式的发送:举出两个方式……
以下程序是SPI主模式的发送:举出两个方式;请问高手:(1)以下何种方式好?(2)请给予完善程序函数的开始和结束为盼!
/*************************************************************************************************/
// SPI Master (SSN is only necessary if the slave requires a slave select signal)
// Method 1; SSN kept low during the transfer of all 10 bytes
SSN = LOW;
for (i = 0; i <= N; i++)
{
U1DBUF = txBufferMaster[i];
while (!U1TX_BYTE);
U1TX_BYTE = 0;
}
SSN = HIGH;
mDataTransmitted = TRUE;
// or
// Method 2; SSN pulled high between every single byte
for (i = 0; i <= N; i++)
{
SSN = LOW;
U1DBUF = txBufferMaster[i];
while (!U1TX_BYTE);
SSN = HIGH;
U1TX_BYTE = 0;
}
mDataTransmitted = TRUE;