User guide

14
In our case, the communication is unidirectional, the board does not have receive
capabilities. It continuously sends the data read from the sensor and formatted according
to our protocol.
From the previous sections, the protocol we choose for transmitting the temperature
values from the board to Palm consisted of a series of 3 bytes, which we refer to as a,b
and c in the next paragraphs.
Besides receiving the data from the infrared port and computing the temperature, the
receiver software on Palm should be able to also provide synchronization with the data
stream (a, b, c in the correct sequence), correct all the possible errors or signal if
something is wrong (e.g.: no data stream is present).
For synchronization, we observe that the three bytes received always have the following
properties:
a – no special property
b – starts with bit ‘0’
c – starts with bit ‘1’
Using these properties of a, b, c we can always decide if a sequence of 3 consecutive
bytes is in the correct sequence ([a, b, c]) or not ([b, c, a] or [c, a, b]). Moreover, we can
take measures to ensure correct synchronization at the beginning of next group of 3 bytes.
For that we might need to read additional one or two bytes from the stream.
If for any reasons, during any of the reads we specified above we get an error, the whole
process starts from beginning, after signaling the error.
The flow of all operations in the IR receiver is depicted below:
Initialization
Test external
events
Sync.
Error
Receive
Error
Read 3 bytes
Finalization
Synchronization?
(Byte order)
Compute
Temperature
Correct Wrong
Bit Error
Bit Error
N
o events
Events
Read bytes
(1 or 2)