armsistem

Hi, I'm sorry , My English is very bad ; I working UART0 send a receive (LPC2104) but receive I don't want to work. below code

int getchar (void) /* Read character from Serial Port */
  {while (!(U0LSR & 0x01));
     return (U0RBR);
  }

I wants to do ; pc send (hyperterminal or docklight) 'LED1 ON' or 'LED1 OFF' if(U0RBR=='LED1 ON') {event} else if(U0RBR=='LED1 OFF') {event} not work

help me , thanks

Parents
  • It's better than I could do any any other language!

    Do you have the LPC2104 documentation in your own language?

    The documentation is absolutely fundamental to understanding how the chip woprks and, thus, how to use it.
    If you can't get it in an understandable formm then that is a serious problem!

    if( U0RBR == 'LED1 ON' )
    

    In 'C', strings need to be enclosed in double quotes - thus: "LED1 ON"

    In 'C', the == operator does not compare the contents of strings.

    Think about how many characters can the U0RBR register hold? And how, then, can you compare it to a string??

Reply
  • It's better than I could do any any other language!

    Do you have the LPC2104 documentation in your own language?

    The documentation is absolutely fundamental to understanding how the chip woprks and, thus, how to use it.
    If you can't get it in an understandable formm then that is a serious problem!

    if( U0RBR == 'LED1 ON' )
    

    In 'C', strings need to be enclosed in double quotes - thus: "LED1 ON"

    In 'C', the == operator does not compare the contents of strings.

    Think about how many characters can the U0RBR register hold? And how, then, can you compare it to a string??

Children
More questions in this forum