主题中讨论的其他器件:MSPM0G3507
工具与软件:
我会将我的连接、设置、示例代码以及我创建的代码发送给您。 我无法通过 SPI 接收信息。
示例代码;(用于其他 MCU)
MSPM0G3507代码:
unsigned char MFRC522_SPIreceive (unsigned char address_rcv)
{
SPI_RECEIVE_ADDRESS=(((address_rcv<<1)&0x7E)| 0x80);
DL_SPI_setControllerCommandDataModeConfig (SPI_0_INST、1);// 1 Bayt komut gönderilecek
DL_SPI_transmitData8 (SPI_0_INST、SPI_RECEIVE_ADDRESS);
while (DL_SPI_isBusy (SPI_0_INST))
;
DL_SPI_setControllerCommandDataModeConfig (SPI_0_INST、1);// 1 Bayt komut gönderilecek
DL_SPI_transmitData8 (SPI_0_INST、dummy);
while (DL_SPI_isBusy (SPI_0_INST))
;
SPI_RECEIVED_DATA = DL_SPI_receiveDataBlocking8 (SPI_0_INST);
返回 SPI_RECEIVED_DATA;
}
void MFRC522_SPIsend (unsigned char address_snd、unsigned char data_snd)
{
SPI_SEND_ADDRESS=((ADDRESS_SND<<1)&0x7E);
SPI_SEND_DATA= data_snd;
DL_SPI_setControllerCommandDataModeConfig (SPI_0_INST、1);// 1 Bayt komut gönderilecek
DL_SPI_transmitData8 (SPI_0_INST、SPI_SEND_ADDRESS);
while (DL_SPI_isBusy (SPI_0_INST))
;
DL_SPI_setControllerCommandDataModeConfig (SPI_0_INST、1);// 1 Bayt komut gönderilecek
DL_SPI_transmitData8 (SPI_0_INST、SPI_SEND_DATA);
while (DL_SPI_isBusy (SPI_0_INST))
;
}