SCI implements multi-byte transmission
Receive: Single byte is processed as multibyte.
Sending: Multi-byte processing is single-byte.
When sending, you need to pay attention to the byte alignment of the structure, so that the array of the union will be the same as the setting.
Send out bytes
Method 1:
for(i=0;i<size;i++)
{
while(SciaRegs.SCIFFTX.bit.TXFFST !=0)
{}
SciaRegs.SCITXBUF.bit.TXDT = array[i] & 0x00ff;
//或者使用
//SciaRegs.SCITXBUF.all = array[i] & 0x00ff;
}
Method Two:
for(i=0;i<size;i++)
{
DELAY_US(100);
SciaRegs.SCITXBUF.bit.TXDT = array[i] & 0x00ff;
//或者使用
//SciaRegs.SCITXBUF.all = array[i] & 0x00ff;
}