UART RX Interrupt - need to repeat send a CHAR to go into interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

UART RX Interrupt - need to repeat send a CHAR to go into interrupt

524件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by teslabox on Tue Mar 25 05:05:08 MST 2014
Hi everyone,

I nedd to do something in the interrupt when I get something thru UART.
I wrote a simply C code for UART RX Interrupt but I have to send 2 o 4 or multiply of 2 characters to force the UART RX Interrupt and toogle the test LED.
What is wrong?

Below is my code:
int main (void)
{
InitTimer32b_0 ();// Set clock to the Timer 32-bit No. 0
UARTInit (115200);

LPC_UART->IER |= (1<<0)|(1<<1)|(1<<2);
NVIC_EnableIRQ (UART_IRQn);// 21 UART interrupt status

LPC_GPIO1->DIR |= (1<<8);// PIO 1.8 -> LD1 (right LED)
LPC_GPIO1->DATA|= (1<<8);// PIO 1.8 -> LD1 (right LED)

for (;;)
{
Timer32b_0_ms (500);
LPC_GPIO0->DATA^= (1<<1);
}
 return (0);
}

void UART_IRQHandler (void)
{
uint32_t temp = 0;

  if ((LPC_UART->IIR >> 2) & 0x01)

  {
  LPC_GPIO1->DATA ^= (1<<8);// Toogle LED on pin PIO1.8
  temp = LPC_UART->RBR;
  }

  return;
}
0 件の賞賛
返信
0 返答(返信)