主席先生:
使用了 sci 奇偶校验功能,但无法更改奇偶校验
函数调用如下:
/* UART 奇偶校验,使能==(sciParityEnable = 1),禁用==(sciParityEnable = 0)
sciParity = 0是奇数、sciParity == 1是偶数*/
空 sciSetParity (sci_t * sci、uint8 sciParityEnable、uint8 sciParity)
{
uint32 sci_temp;
sci_temp = sci->GCR1;
SCI_temp =(sci_temp & 0xfffff3U);//GCR1 bit3=0 & bits2=0
if (sciParityEnable = 1)//启用奇偶校验
{
if (sciParity ==1)
{
SCI->GCR1 = sci_temp |(uint32)((uint32) 1U << 2U)//启用奇偶校验
|(uint32)((uint32) 1U << 3U);//偶校验
}
其他
{
SCI->GCR1 = sci_temp |(uint32)((uint32) 1U << 2U)//启用奇偶校验
|(uint32)((uint32) 0U << 3U);//奇数奇偶校验
}
}
else //禁用奇偶校验
{
SCI->GCR1 = sci_temp |(uint32)((uint32) 0U << 2U);//禁用奇偶校验*
}
}
最恰当的考虑
作者:Ken Lin