BOOL _SerialReadByte(unsigned char* Dest, DWORD timeout_us) { int bytesReady = 0; DWORD tim1 = TickGet(); do { if( ((TickGet() - tim1) * 16) > timeout_us) return FALSE; bytesReady = RS485BufferSize(Port_); }while(bytesReady < 1); RS485Read(Port_, (char *)Dest, 1); return TRUE; }
int RS485Read() { return RS485Read(10, 10); }