This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MCB2300 UARTs question

Hi,
I bought MCB2300 to start my project now.
Without any modifications on the UART demo code,
MCB2300 can work properly on UART0 and UART1(I connected UART0/UART1 to PC with Hyperterminal, typing a character, MCB2300 can sent back same character).
But I tried to keep sending a character from MCB2300 to PC on UARt1, hypterminal only recivered one sending.Using UART0 has the same problem.
following is my modification, anybody can help me to figure out what's wrong? highlight are my changes.
Thanks
Jack

int main (void)
{
    UARTInit(0, 115200);        /* baud rate setting */
    UARTInit(1, 115200);        /* baud rate setting */


    UART1Count =1;
    UART1Buffer[0] = 0x41;


  while (1)
  {
        /* Loop forever */
        if ( UART0Count != 0 )
        {
          U0IER = IER_THRE | IER_RLS;                   /* Disable RBR */
          UARTSend( 0, (BYTE *)UART0Buffer, UART0Count );
          UART0Count = 0;
          U0IER = IER_THRE | IER_RLS | IER_RBR; /* Re-enable RBR */
        }
        if ( UART1Count != 0 )
        {
          U1IER = IER_THRE | IER_RLS;                   /* Disable RBR */
          UARTSend( 1, (BYTE *)UART1Buffer, UART1Count );
          UART1Count = 0;
          U1IER = IER_THRE | IER_RLS | IER_RBR; /* Re-enable RBR */
        }
  }
  return 0;
}

void UARTSend( DWORD portNum, BYTE *BufferPtr, DWORD Length )
{
  if ( portNum == 0 )
  {
    while ( Length != 0 )
    {
          /* THRE status, contain valid data */
          while ( !(UART0TxEmpty & 0x01) );
          U0THR = *BufferPtr;
          UART0TxEmpty = 0;     /* not empty in the THR until it shifts out */
          BufferPtr++;
          Length--;
        }
  }
  else
  {
        while ( Length != 0 )
    {
          /* THRE status, contain valid data */
          while ( !(UART1TxEmpty & 0x01) );
          U1THR = *BufferPtr;
          UART1TxEmpty = 0;     /* not empty in the THR until it shifts out */

          //BufferPtr++;        /always to send UART1Buffer[0] */

          Length--;
    }
  }
  return;
}

0