How to unpack bytes in the right order after receiving a vector from serial?
Show older comments
Hi, I'm transmitting a vector of 3 signals (let's say 'a', 'b' and 'c') from a Serial Transmit block, and previously packing these signals with the Byte Pack block. The input of the Byte Pack has the signals in alphabetical order. So, the 'a' signal is at index 1, 'b' is at index 2 and 'c' is at index 3.
On the other end, the Serial Receiver is connected to a Byte Unpack block and the received data is logged. When I see the logged data, they look "shifted" 2 indexes over the vector. So, the data corresponding to the 'a' signal is now accessible by index 3, the 'b' data is at index 1, and 'c' at index 2.
Why is this happening? How can I be sure that all data transmitted will be always 2 ports "shifted"?
Answers (0)
Categories
Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!