This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/MSP430G2553: MSP430G2553

Part Number: MSP430G2553

Tool/software: TI C/C++ Compiler

Hello,

I am beginner in embedded c, so can you please help what the code  "while (!(IFG2&UCA0RXIFG));" means.

  • in case either IFG2 or UCA0RXIFG is 0, it is while(!0), code will stay in while loop. in case both IFG2 and UCA0RXIFG are 1, it is while (0). code will continue running. this code is waiting flag setting. Thanks

  • UCA0RXIFG becomes =1 when a byte is received by the serial port (USCI) UCA0. It becomes =0 when the program reads that byte from UCA0RXBUF. [Ref F2 series User Guide (SLAU144J) Section 15.4.13]

    On the G2 Launchpad UCA0 is the "backchannel" UART connected to the USB (and thus to the PC), so this will happen when the PC sends a byte to the MSP430.

    That loop spins (doesn't go on to the next line) until a byte is received.