Reading Binary from Serialport and identifying a particular message structure
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to read streams of binary data in from a device via the serial port.
My short code is shown below:
function gnssbinary
device = serialport ( "COM4" , 115200);
data = read (device, 50000, 'uint64' );
disp (dec2hex (data))
end
- The information I am looking or have header, Class and and ID of 0 x b5, 0 x 62, 0 x 02 and 0 x 15 in that order and the following messages should be the real information I need.
- I arbitrary used 5000 as the number of values (in the read syntax) to be read because it is like looking for a needle in a hay stack
- I have been able to get 0 x b5, 0 x 62, 0 x 02 from the binary but not yet what I am looking for which should still have 0 x 15.
- how do I program the MATLAB to keep identify the messahe identifier in (1) above, read the messages that come after and ignore the rest until it encounters the same message identifer again and repeat the process?
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!