We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I am using LPC mx-1114/301 board. Small piece of code written to send and receive the data to and from Hyper terminal. Output, not showing typed data on terminal window. Any problem in source code? Can be appreciated to sort me out this. Here the code,
#include"lpc11xx_syscon.h" #include"lpc11xx_gpio.h" #include "lpc11xx_uart.h" #include "LPC11xx.h"
#define SystemCoreClock 12000000UL #define RDR 0x01 #define THRE 0x20
int main(void) { unsigned char data; uint32_t baudrate = (uint32_t)115200 ; uint32_t DL;
LPC_IOCON->PIO1_6 = 0x01; LPC_IOCON->PIO1_7 = 0x01;
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<12); LPC_SYSCON->UARTCLKDIV = 0x01; //UART clock DL = (SystemCoreClock * LPC_SYSCON->SYSAHBCLKDIV) / (16 * baudrate * LPC_SYSCON->UARTCLKDIV); LPC_UART->LCR = 0x83; //0x10000011; LPC_UART->DLM = 0x01; //DL / 256; LPC_UART->DLL = 0x86; // DL % 256; LPC_UART->LCR = 0x03; //0x00000011; LPC_UART->FCR = 0x07; //0x00000111;
while(1){
while (!(LPC_UART->LSR & RDR)); data = LPC_UART->RBR;
while (!(LPC_UART->LSR & THRE)); LPC_UART->THR = data; } }
Thanks,