This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC 2138 simple problem

Hi all,

I have a small starter problem with my LPC2138

I'm using Flash Magic to make the hex file and program it to the arm controller.

I managed to make a serial connection with the terminal on Flash magic, so I can send characters to it.

What I want to do is to print a sentence to the terminal.

this is how I print a character:

void    outchar0(char k)
        {
        unsigned long a;                        //local variable
        U0THR=k;                                        //ascii code to buffer transmitter
                while((a=U0LSR&0x41)!=0)
                {
                }
        }

Parents
  • "Call the function you've posted once for each character in the sentence"

    But wouldn't you find it interesting that the loop inside a function outchar0() worries about Receiver Data Ready (0x01) or Transmitter Empty (0x40)? It isn't obvious what reception of data has with transmit to do. Especially since the code as written may insert a new character to transmit even if the UART isn't ready.

Reply
  • "Call the function you've posted once for each character in the sentence"

    But wouldn't you find it interesting that the loop inside a function outchar0() worries about Receiver Data Ready (0x01) or Transmitter Empty (0x40)? It isn't obvious what reception of data has with transmit to do. Especially since the code as written may insert a new character to transmit even if the UART isn't ready.

Children
  • But wouldn't you find it interesting that the loop inside a function outchar0() worries about Receiver Data Ready (0x01) or Transmitter Empty (0x40)?

    I'd hazard a guess that it was an attempt to get the the thing to respond to a character received by the UART, but yes, it seems quite wrong. I hadn't appreciated that the OP was quite as close to the beginning of the learning curve as now seems apparent.