<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>I have a problem with lpc2148 uart receiver (with interrupt)</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/35884/i-have-a-problem-with-lpc2148-uart-receiver-with-interrupt</link><description> 
Hello Sir, 
when I use lpc2148 UART receiver interrupt then microcontroller is
not receiving any value 
but if I use a simple receiver then it&amp;#39;s working correctly and
receive correct data. 
I&amp;#39;m check this code on both hardware or proteus simulator but</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: I have a problem with lpc2148 uart receiver (with interrupt)</title><link>https://community.arm.com/thread/83464?ContentTypeID=1</link><pubDate>Thu, 05 Jan 2017 04:21:57 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f838e127-5ee0-4653-9312-641d2366b450</guid><dc:creator>Bhura Malik</dc:creator><description>&lt;p&gt;&lt;p&gt;
[modify] LPC2148 UART receiver interrupt code sir, I am added
comment in this code, now this modified code is working on proteus
but on hardware, it shows the 0xFF value of entered character&lt;/p&gt;

&lt;pre&gt;

#include &amp;lt;lpc214x.h&amp;gt;
volatile long  x;
void initUart0(void);

void delay(int time)   //delay function
{
        int i,j;
        for(i=0;i&amp;lt;time;i++)
          for(j=0;j&amp;lt;10275;j++);
}
void Uart0ISR(void) __irq;
void initClocks(void)
{
        PLL0CON = 0x01;   //Enable PLL
        PLL0CFG = 0x24;   //Multiplier and divider setup
        PLL0FEED = 0xAA;  //Feed sequence
        PLL0FEED = 0x55;

        while(!(PLL0STAT &amp;amp; 0x00000400)); //is locked?

        PLL0CON  = 0x03;   //Connect PLL after PLL is locked
        PLL0FEED = 0xAA;  //Feed sequence
        PLL0FEED = 0x55;
        VPBDIV   = 0x01;    // PCLK is same as CCLK i.e.60 MHz
}
int main(void)
{
        IO0DIR = 0xFF0000;
  initClocks();    //init Clocks
        initUart0();        // init uart0
        while(1){
                IOSET0 = x&amp;lt;&amp;lt;16;  // { ascii value set on IOPIN 16 - IOPIN 23}
                delay(500);
                IOCLR0 = x&amp;lt;&amp;lt;16;  // clear IOPIN
                delay(5);
        }
}

void initUart0(void)
{

        PINSEL0 = 0x5;  /* Select TxD for P0.0 and RxD for P0.1 */
        U0LCR   = 0x83; /* 8 bits, no Parity, 1 Stop bit | DLAB set to 1 */
        U0DLL   = 78;   //baud Rate 9600 at 12MHZ
        U0DLM   = 1;
        U0FDR   = 0xF1; /* MULVAL=15(bits - 7:4) , DIVADDVAL=0(bits - 3:0)*/
        U0LCR &amp;amp;= 0x0F; // Set DLAB=0 to lock MULVAL and DIVADDVAL
        U0IER=0x1;     // Enable RBR interrupt
        VICVectAddr1 = (unsigned long)Uart0ISR;
        VICVectCntl1 = 0x20 | 6;
        VICIntEnable |= (1&amp;lt;&amp;lt;6);
        //BaudRate is now ~9600 and we are ready for UART communication!
}
void Uart0ISR(void) __irq
{
        long int regVal;
        regVal = U0IIR;
         x      = U0RBR;     //read data
         VICVectAddr = 0x0;

}/*
char uartoRec()
{
        while(!(U0LSR&amp;amp;(0x01)));
        x = U0RBR;
        return x;
}
*/


&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I have a problem with lpc2148 uart receiver (with interrupt)</title><link>https://community.arm.com/thread/69751?ContentTypeID=1</link><pubDate>Thu, 05 Jan 2017 03:12:03 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e6709700-0b4a-4fa4-8a99-355b9208dd3a</guid><dc:creator>edPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Good of you to initialize the UART with not a single comment or
named constant to make a reader understand how you initialize it.&lt;/p&gt;

&lt;p&gt;
Another thing - x is an 8-bit value and you do a 16-bit shift.&lt;/p&gt;

&lt;p&gt;
And an ISR is also expected to look at the available flags to
figure out the interrupt reason - the UART can produce interrupts for
more than just reception of a character.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>