Send a hex block of data Serial port from matlab
이전 댓글 표시
Hi,
I have a problem, I have a serial device which should addressed using a block of data in specific format. The data I am trying to send is [7E 00 12 10 00 00 13 A2 00 40 8B 63 85 08 59 00 00 00 00 00 1A 0C], all in hexadecimal. How to send it in a single go? The command is correct since I am able to send the same via a serial terminal program and the device responds.
I can do the same using a arduino by the following command: Serial.write(array,sizeof(array));
How to do the same kind in matlab?
Kindly please help.
Thanks in advance, Mike
채택된 답변
추가 답변 (2개)
Jan
2013년 10월 7일
"All in hexadecimal" is not clear. You cannot store values in hexadecimal format like e.g.:
a = [7E 00 12 10 00 00 13 A2 00 40 8B 63 85 08 59 00 00 00 00 00 1A 0C]; % ERROR!
You would need e.g. a string (char vector):
a = ['7E', '00', '12', ...
But to send this, you would convert it to UINT8 values at first, most likely. So please explain this detail.
댓글 수: 2
Michael Mathew
2013년 10월 8일
편집: Michael Mathew
2013년 10월 8일
Jan
2013년 10월 8일
"It does not work" is not useful to explain the occurring problems. Please tell us, what happens.
Michael Mathew
2013년 10월 8일
0 개 추천
댓글 수: 3
Yonathan
2013년 12월 3일
Hey Michael what's the solution? I have a similar conflict
Kritika Vashishtha
2020년 5월 8일
Hey Michael, Can you post the answer. The link that you shared no more exists.
Ferran Gonzalez
2022년 11월 8일
Hi @Yonathan @Kritika Vashishtha, you can read an archived version of the link here: https://web.archive.org/web/20151224041528/https://in.mathworks.com/matlabcentral/newsreader/view_thread/79757
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!