ASCII Encoding/Decoding Resync Loopback Test

This model shows the ability of the FIFO Read HDRS block to resynchronize after being repeatedly disabled as well as the ability to resolve errors such as when a message is only partially complete at the time the read is attempted.

The Switch block alternates between the first and last parts of the message on successive sample times. This mimics a worst case scenario where the model updates before the message construction is complete. As a result, sometimes only part of the message is received. The second pulse generator alternately enables and disables the FIFO Read HDRS block.

Scope 1 graphs the decoded sine wave data received at each time step. When the Pulse Generator1 block outputs a 0, the count from the FIFO Read HDRS block is 0. When it outputs a 1, the read catches up by throwing away extra data and returns the last complete value found in the FIFO. Scope 2 indicates when new data is present.

Was this topic helpful?