2 Replies Latest reply on Jun 10, 2011 2:34 AM by atkuri.mounika

    query regarding UART

    atkuri.mounika

      Hello
      Good Afternoon!
      I am Mounika. I am doing a project on power line communication using IC CY8CPLC20. I am using an RS232 to interface the board to the PC. When I transfer data it is being transmitted continuosly though I am resetting the buffer using the UART function UART_CmdReset (maybe because RX data buffer is not getting cleared.).
      1. How do I clear RX data buffer register once I read it?
      2. What is the difference between Rx data register and Rx data buffer register?
      3. What exactly does UART_CmdReset function perform?
      4. How to use the UART_bReadRxStatus function to monitor the UART_RX_REG_FULL bit of the RX Control register?
      I am enclosing the code that I am using. Please do reply as soon as possible. It is urgent!
      Thanking you,

      Regards,
      Mounika

        • 1. Re: query regarding UART
          atkuri.mounika

          the code that I used is enclosed below

             

          -Mounika

          • 2. Re: query regarding UART
            atkuri.mounika

            sorry haven't been able to attach the code, it is as follows

               

            #include <m8c.h>        // part specific constants and macros
            #include "PSoCAPI.h"   // PSoC API definitions for all User Modules
            #include "PWM8_1.h"
            #include "UART_1.h"

            void UART_1_Start(BYTE bParitySetting);
            void PWM8_1_Start(void);
            void UART_1_EnableInt(void);
            void UART_1_CmdReset(void);
            BYTE status;

            void main(void)
            {
                // M8C_EnableGInt ; // Uncomment this line to enable Global Interrupts
                PLT_Start();
                UART_1_IntCntl(UART_1_ENABLE_RX_INT);
                UART_1_Start(UART_PARITY_NONE);
                PWM8_1_Start();
               
                PLT_Memory_Array[Modem_Config]=(Modem_FSKBW_3M | Modem_BPS_2400);
                PLT_Memory_Array[TX_Gain]=0x03;
                PLT_Memory_Array[RX_Gain]=0x06;
                PLT_Memory_Array[Local_LA_LSB]=0x01;
                PLT_Memory_Array[PLC_Mode]=TX_Enable;
                PLT_Memory_Array[TX_CommandID]=CMD_SENDMSG;
                PLT_Memory_Array[TX_DA]=0x02;
                PLT_Memory_Array[TX_Message_Length]=0x01;
                PLT_AutoSetBIUThreshold();
               
                UART_1_CmdReset();
               
                while(1)
                {
               
                   UART_1_CmdReset();
                   status=UART_1_bReadRxStatus();
                   status &=0x08;
                   if(status==0x08)
                   {
                 
                   PLT_Memory_Array[TX_Data]=UART_1_bReadRxData();
                   PLT_SendMsg();
                   UART_1_CmdReset();
                   PLT_Poll();
                       
                   }
                  
                }
            }