lpcware

Lpc11c24 uart

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by urb4nm on Mon Feb 18 04:03:01 MST 2013
Hi,
I'm not-so-advanced in this kind of programming, and I've stumbled upon a minor problem.

I have to write a code for LPC11C24 to work with CO2 sensor using MODBUS protocol. No interrupts, just a simple write read sequence. I've got UART set correctly (done it before). What I need is to send a sequence, eg. {0xFE, 0x00,...} and read similar sequence back. I've tried to use something I've done before

void uart_send_byte(const uint8_t byte)
{
  while(!(LPC_UART->LSR & 0x20));
  LPC_UART->THR = byte;
}


for each byte of the sequence, but then it looks like there's nothing to receive. The thing is I don't know whether I messed up the sending, or receiving as I don't really know how to print output in console... This may sound like a noobish problem, and in fact it kind of is, but any help would be deeply appreciated...

Outcomes