Hi George,

Thanks for your question. You need to create a kind of state machine which basically does the following (one line = one task period):

Write() - send a read request to the device Read() - save received data and length into a global buffer/variable and distinguish if the received message is complete Retry and repeat Read() if the previously received message was not complete

You will need to introduce a timeout - it can happen that you lost some data so there should be some timeout when you say "Message incomplete, resend the read request".