zengwl1016 发表于 2012-2-13 09:10:07

LPC2366串口0和串口1通信,求高手请教,单个字节可以实现,多个字节就有问题

本人是新手,在编写LPC2366的串口通信时,串口0和串口1之间的通信,单个字节的时候可以实现,但传输字符串的时候就出问题,请高手请教,这是我的部分程序:
void __irq IRQ_UART1(void)
{

if((U1IIR&0x0F)==0x04)
{
    rcv1_new = 1;   // 设置接收到新的数据标志,并清除中断标志位
        zifu1=U1RBR;
   }
VICVectAddr = 0x00;
}

void UART1_Init()
{   
        unsignedlong Fdiv;
    PINSEL0 |= (0x01<<30) ;      /* RxD1 and TxD1 */
        PINSEL1 |=0x01 ;
    U1LCR = 0x83;                /* 8 bits, no Parity, 1 Stop bit */
    Fdiv = ( Fpclk / 16 ) / UART_bps ;        /*baud rate */
    U1DLM = Fdiv / 256;                                                       
    U1DLL = Fdiv % 256;
        U1LCR = 0x03;                /* DLAB = 0 */
    U1FCR = 0x07;                /* Enable and reset TX and RX FIFO. */
      
    VICIntEnClr = 1 << 7;        /* Disable Interrupt */

    VICVectAddr7= (unsigned int)(void *)IRQ_UART1;
        VICVectPriority7=0;
        VICIntEnable = 1 << 7;        /* Enable Interrupt */

    U1IER = 0x01|0x02 ;        /* Enable UART1 interrupt */
}
while(1)
{
        for(j=0;j<10;j++)
        {
   UART1_SendByte(send_buffer);
   if( rcv1_new==1)
      {
           rcv1_new = 0;
          UART0_SendByte(zifu1);
      }

       }
页: [1]
查看完整版本: LPC2366串口0和串口1通信,求高手请教,单个字节可以实现,多个字节就有问题