AW60芯片SCI配置为9个数据位,偶校验。初始化代码如下,代码上电运行正常,通过串口发送一个数据后,接收中断一直重复进入,无法关闭。
各位帮忙看看,哪里问题。?
void uart0_init(void)
{
/* SCI1C1: LOOPS=0,SCISWAI=0,RSRC=0,M=0,WAKE=0,ILT=0,PE=0,PT=0 */
SCI1C1 = 0x12;
/* SCI1C3: R8=0,T8=0,TXDIR=0,TXINV=0,ORIE=0,NEIE=0,FEIE=0,PEIE=0 */
SCI1C3 = 0x00;
/* SCI1S2: BRK13=0,RAF=0 */
SCI1S2 = 0x00;
/* SCI12C2: TIE=0,TCIE=0,RIE=1,ILIE=0,TE=1,RE=1,RWU=0,SBK=0 */
SCI1C2 = 0x00;
/* SCI1BD: SBR12=0,SBR11=0,SBR10=0,SBR9=0,SBR8=0,SBR7=0,SBR6=0,SBR5=1,SBR4=1,SBR3=0,SBR2=1,SBR1=0,SBR0=0 */
SCI1BD = (word)0x34;
/* SCI1C2: TIE=0,TCIE=0,RIE=1,ILIE=0,TE=1,RE=1,RWU=0,SBK=0 */
//SCI1C2 = 0x2C;
SCI1C2 |= (SCI1C2_RE_MASK | SCI1C2_RIE_MASK);
//SCI1C1_PE = 1;
//SCI1C1_PT = 0;//20140902 偶校验
}
__interrupt VectorNumber_Vsci1rx void SCI_RX(void) //
{
byte Data; /* Temporary variable for data */
if (SCI1S1_RDRF==0) return;
(void)SCI1S1;
Data = SCI1D;
}
|