void comFlush (u8 comCh)
comCh : Channel number |
Clears the receive buffer for channel comCh.
{ char c[64]; openCom(0, 115200, C8N1); // Channel 0, 115200 Baud, // data bits: 8, no parity, stop bits: 1 while (1) // Repeat forever { if(comLen(0) > 0) // if data exists in the receive buffer { comGets(0, c, 64); // Read data from receive buffer in store it // and store it in char array, c. if (portIn(0) == 0) comFlush(0); // when push s/w connect at port 0, clear channel 0. } } }