CAN message in simulink
이전 댓글 표시
hi,
I am facing a problem that How i can load base workbase message to my simulink vehicle network toolbox block CAN -transmit
답변 (1개)
Harimurali
2024년 2월 7일
0 개 추천
Hi Shiyad,
The "From Workspace" block and the "CAN Pack" blocks can be used to load base workspace message to be used by the "CAN Transmit" block. Follow the below steps to do the same:
- Store the data to be transmitted as part of the CAN message in a variable in the base workspace. The data should be in a format that the "From Workspace" block supports.
%For example
Data = [1 2 3 4 5 6 7 8];
% Create a time-structured data for the 'From Workspace' block
message_ts = struct('time', 0, 'signals', struct('values', Data));
- Add "From Workspace" and specify the "message_ts" variable that is to be read from the workspace.
- Connect the "From Workspace" block to the "CAN pack".
- Specify the message name, CAN identifier, length etc. of the message in the block parameters dialog box of the "CAN Pack" block. The length specified should be equal to the number of data elements.
In this way you can transmit data from the base workspace as a CAN message in Simulink.
Refer the following documentations for information about:
- "From Workspace" block: https://www.mathworks.com/help/releases/R2023b/simulink/slref/fromworkspace.html
- "CAN Pack" block: https://www.mathworks.com/help/releases/R2023b/vnt/ug/canpack.html
- "can.Message" object properties: https://www.mathworks.com/help/releases/R2023b/vnt/ug/can.message-properties.html
카테고리
도움말 센터 및 File Exchange에서 Communication in Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!