I have the following codes to send one single character via serial port and hear back from the device.
if(!(IFG2&UCA1RXIFG) )
{
DelayMs(100);
if (UCA1RXBUF == '1' )
{
DelayMs(1000);
UCA1TXBUF = '\n';
DelayMs(1000);
UCA1TXBUF = '\r';
DelayMs(1000);
UCA1TXBUF = '@';
}
}
So as you can see, if you send 1 via serial port, you well get the character "@". Now, I would like to know how I can send two digits let's say 12 to get the same character back?
if I write
if (UCA1RXBUF == '1' )
{
if (UCA1RXBUF == '2' )
{
does not work. Because there is not enough time to get the second digit. And even with enough delay is too hard to get the second one. So, is there any solution for this? Any idea on that?
Thanks!