uart interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

uart interrupt

534 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Thu Dec 06 04:57:47 MST 2012
Hi..!!

What this part of interrupt will do in UART.

  /* Enable the UART Interrupt */
  NVIC_EnableIRQ(UART_IRQn);

#if CONFIG_UART_ENABLE_INTERRUPT==1
#if CONFIG_UART_ENABLE_TX_INTERRUPT==1
  LPC_UART->IER = IER_RBR | IER_THRE | IER_RLS;    /* Enable UART interrupt */
#else
  LPC_UART->IER = IER_RBR | IER_RLS;    /* Enable UART interrupt */
#endif
#endif
0 Kudos
6 Replies

446 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Tue Dec 11 02:55:19 MST 2012

Quote: vasanth
@researchinnovation,
              There is no research nor innovation in this type of questions. It is a plain old 'C' concept called as preprocessor directives. A simple search in your C book might have provided you the answer.

Please use the expertise available here (forum) for discussing complex topics and problems.

@Vasanth
And you please do not waste your time like this.
Go and  do Eureka instead of wasting your own precious time here.
0 Kudos

446 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vasanth on Tue Dec 11 00:38:40 MST 2012
@researchinnovation,
              There is no research nor innovation in this type of questions. It is a plain old 'C' concept called as preprocessor directives. A simple search in your C book might have provided you the answer.

Please use the expertise available here (forum) for discussing complex topics and problems.
0 Kudos

446 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Mon Dec 10 23:20:06 MST 2012

Quote: Serge
Gray shaded code is not used.
If your IF statement is FALSE with other words: #if CONFIG_UART_ENABLE_INTERRUPT==0
The code is not executed nor compiled.


Thanks a lot....!!!
0 Kudos

446 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Mon Dec 10 00:38:19 MST 2012
Gray shaded code is not used.
If your IF statement is FALSE with other words: #if CONFIG_UART_ENABLE_INTERRUPT==0
The code is not executed nor compiled.
0 Kudos

446 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Sun Dec 09 20:30:36 MST 2012

Quote: graynomad
What's your question?




If  put #if CONFIG_UART_ENABLE_INTERRUPT==0,#if CONFIG_UART_ENABLE_TX_INTERRUPT==0, then rest of the part of the code becomes gray shade and this part doesn't get executed while compiling.
That is why I want to know in details, what is happening here.



/* Enable the UART Interrupt */
  NVIC_EnableIRQ(UART_IRQn);

#if CONFIG_UART_ENABLE_INTERRUPT==1
#if CONFIG_UART_ENABLE_TX_INTERRUPT==1
  LPC_UART->IER = IER_RBR | IER_THRE | IER_RLS;    /* Enable UART interrupt */
#else
  LPC_UART->IER = IER_RBR | IER_RLS;    /* Enable UART interrupt */
#endif
#endif
0 Kudos

446 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by graynomad on Sun Dec 09 15:32:58 MST 2012
What's your question?
0 Kudos