2 Replies Latest reply on Aug 4, 2012 2:42 AM by user_1377889

    Working with UART

    srihari.s

       Hello all

         

      i started working with UART..the UART configuration window has many options.

         

      i have few questions-

         

      1. What is the exact difference between FIFO and buffer.

         

      2. when the buffer size is greater than 4 Internal interrupt gets enabled. Where can i write my code if i need to use internal interrupt

         

      3. in half duplex mode how can i transmit and receive data.

        • 1. Re: Working with UART
          user_1377889

          The FIFO is 4 bytes deep and can work as a small buffer to store incoming characters.

             
              The buffer is handled by an     internal interrupt routine which is turened on when the buffersize is larger than the FIFO-size. Since it is internal it is of no use when you want to provide your own interrupt routine which is easy to implement:   
             
              Drop an interrupt-component and connect it to your UART, wirite your interrupt handler with CY_ISR_PROTO and CY_ISR macros (have a look at the "System Reference Manual" [Help -> Documentation ->]) Start your handling with Isr_StartEx(Your_ISR_Routine).   
             
              What to do in an Interrupt handler? Well, the usual job would be to write a circular buffer which you can ask for characters already got, and from which you may read buffered chars.   
             
                  
             
              Same applies to sending chars, putting them into the buffer and sending them out when transmitter is empty, blocking and waiting entering new chars when the buffer has become full.   
             
                  
             
              This is roughly the job the provided internal ISRs do for you, but I always suggest (at least once in a life) to write routines like that yourself, they are so very fundamental principles of operation...   
             
                  
             
              Happy interupts   
             
              Bob   
          • 2. Re: Working with UART
            user_1377889

            Oh, I forgot point 3. There is an API UART_WriteControlRegister() with which you may switch from sending to receiving data from the UART, have a look into the datasheet pg. 16.

               

             

               

            Bob