LPC1113 / LPC1114 UART 인터럽트 테스트
LPC1114 UART 인터럽트 초기화 함수
void U0_SetInt(void)
{
NVIC_EnableIRQ(UART_IRQn);
LPC_UART->IER = IER_RBR | IER_RLS; /* Enable UART interrupt */
}
LPC1114 인터럽트 핸들러 함수
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | //----------------------------------------------------------------------------- #pragma diag_suppress=Pa082 void UART_IRQHandler(void) { uint8_t IIRValue, LSRValue; unsigned char temp; IIRValue = LPC_UART->IIR; IIRValue >>= 1; /* skip pending bit in IIR */ IIRValue &= 0x07; /* check bit 1~3, interrupt identification */ if (IIRValue == IIR_RLS) /* Receive Line Status */ { } else if (IIRValue == IIR_RDA) /* Receive Data Available */ { temp = LPC_UART->RBR; U0_PutByte(temp); } else if (IIRValue == IIR_CTI) /* Character timeout indicator */ { } else if (IIRValue == IIR_THRE) /* THRE, transmit holding register empty */ { } } #pragma diag_default=Pa082 //----------------------------------------------------------------------------- | cs |
반응형