void uart2(void){
LPC_SC->PCONP |= (1<<24); // power to the uart2 peripheral
LPC_UART2->LCR = 0x83; // 8 bits, parity none, stopbit 1, DLAB ENABLED
LPC_UART2->FCR = 7; // FIFO enable, Rx FIFO reset, Tx FIFO reset
LPC_UART2->FCR = 1; // reset fifo
/* Then reset DLAB bit */
LPC_UART2->LCR = 0x03; // disable DLAB so that interrupts are enabled
LPC_UART2->IER = 0x03;
//pinsel for UART2
LPC_IOCON->P0_10 = 1; // UART2 TXD
LPC_IOCON->P0_11 = 1; // UART2 RXD
LPC_IOCON->P5_0 = 0; // SMR_485
LPC_GPIO5->DIR |= (1<<0);
}
|