Serial communication in C

  • Thread starter Thread starter Faiz_UR
  • Start date Start date
F

Faiz_UR

Guest
I want to receive character when its available otherwise code should continue in loop here is my code

init_serial();
for (int i=0;i<100;i++)
{
val(i); // print loop index
if (SetCommMask(serial_RS, EV_RXFLAG)) // interrupt to receive event
{
read_direct(RXbuffer);
show(RXbuffer); // print receive char/string
ClearSerialBuffers(false, true);
}
Sleep(1000);
}

But SetCommMask is always returning true. It's suppose to return tru only when event is received.

Continue reading...
 
Back
Top