AnsweredAssumed Answered

How to use the K64 uart fifo?

Question asked by zhai ling on Mar 14, 2017
Latest reply on Mar 17, 2017 by Robin_Shen

Hi

  I want to use k64 uart fifo implement the function like 51mcu:

void Rcv_ISR () interrupt 4 using 1
{
INT8 data inchar;

if(RI)
{
inchar = SBUF;
if(inchar == '*')
{
RX_Index1 = 0;
}

if(RX_Index1 <= (RX_MAXBUF-1) )
{
RX_BUF1[RX_Index1] = inchar;
if(RX_BUF1[RX_Index1] == '$')
{
if(RX_BUF1[0] == '*')
{
if(RX_BUF1[2] == '2')
{
ACKflag = 1;
}
else
{
if(RX_FULL == 0)
{
RX_FULL = 1;
RX_Index2 = RX_Index1;
memcpy(RX_BUF2,RX_BUF1,RX_Index2+1);
}
else
{
//
}
}
RX_BUF1[0] = 0;
RX_BUF1[2] = 0;
RX_Index1 =0;
}
}
RX_Index1++;
}
else
{
RX_Index1 =0;
}
RI = 0;
}

if(TI)
{
if(TX_EN == 1)
{
if(TX_Tail == TX_Head)
{
if(TX_Full == 1)
{
SBUF = TX_BUF[TX_Tail];
TX_Tail = (TX_Tail+1)%TX_MAXBUF;
TX_Full = 0;
}
else
{
TX_Empty = 1;
}
}
else
{
SBUF = TX_BUF[TX_Tail];
TX_Tail = (TX_Tail+1)%TX_MAXBUF;
}
}
else
{
TX_Empty = 1;
TX_Full = 0;
}
TI = 0;
}

I can't find fifo uart demo in sdk;How to config it ?

Thanks and best regards.

zhai

Outcomes