CAN Receive not working (the Sample time parameter) ??
조회 수: 1 (최근 30일)
이전 댓글 표시
I am using MATLAB R2012b, and I am playing with the demo for the Vehicle Network Toolbox which is called "demoVNTSL_CANCommunication".
I changed some parameters. I changed the block "CAN Transmit ID 500" 's Message period to "0.250", so it will send message 4 time 1 second. And I changed the block "CAN Receive" 's "Sample time" to "0.5" and "Number of messages received at each timestep" to "1", which means it receives only 2 messages per second even though the 4 messages being sent per second. But the simulation result shows it is still receiving 4 messages per second, as shown in the capture image.
Why is that? Basically what I want to do is control the frequency of message receiver. For example, there are 10 messages being sent on the CAN bus per second, but the receiver will only pick one of them per second.
Thanks!
댓글 수: 0
답변 (1개)
Shankar Subramanian
2015년 5월 27일
Hi Xia,
Setting the number of messages received per timestep does not drop the messages queued from transmit. It still receives them at the subsequent timestep. The Transmit block ensures that the data gets transmitted at the right wall-clock time. However, the receive still runs in Simulink simulation time and returns data every timestep. The differing aspect here is that CAN Transmit block "Message Period" is real-wall-clock time and CAN Receive blocks "Sample time" is simulink simulation timestep.
Thanks
Shankar
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Vehicle Network Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!