Hello, I am working in mdk5. For my application I am writting code for RS485. While debugging I found that my FCR register is not loading its value. The code I have written is show below. void uart_rs485(void) { SCU_PinConfigure(2,3, SCU_CFG_MODE_FUNC2);// p2_3 for U3_TXD SCU_PinConfigure(2,4, SCU_CFG_MODE_FUNC2);// p2_4 for U3_RXD GPIO_SetDir(4,11,GPIO_DIR_OUTPUT);// Set GIO_B1_RS485_DIR as output
LPC_USART3->LCR = 0x83;// Line Control Register LPC_USART3->FCR =0x07;//FIFO buffer LPC_USART3->FDR =0;// Fractional Divide LPC_USART3->DLM =0;//Divide Latch MSB LPC_USART3->DLL =98;//Divide Latch LSB LPC_USART3->LCR =0x03;//Disable DLAB
} void uart_rs485_transmit(void) { GPIO_PinWrite(4,11,1);//Making Transmit Enable high if(LPC_USART3->LSR & 0x20) { LPC_USART3->THR = 83; } }
void uart_rs485_receive(void) { GPIO_PinWrite(4,11,0);//Receive Enable a = LPC_USART3->RBR; } Please help me in this flow. Thank you in advance
sorry Carrut. The code id given here. I think you can get it now.
void uart_rs485(void) { SCU_PinConfigure(2,3, SCU_CFG_MODE_FUNC2); SCU_PinConfigure(2,4, SCU_CFG_MODE_FUNC2); GPIO_SetDir(4,11,GPIO_DIR_OUTPUT); LPC_USART3->LCR = 0x83; LPC_USART3->FCR =0x07; LPC_USART3->FDR =0; LPC_USART3->DLM =0; LPC_USART3->DLL =98; LPC_USART3->LCR =0x03;
void uart_rs485_receive(void) { GPIO_PinWrite(4,11,0);//Receive Enable a = LPC_USART3->RBR; }