CAN Receive not working (the Sample time parameter) ??
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Shankar Subramanian
am 27 Mai 2015
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 Kommentare
Siehe auch
Kategorien
Mehr zu Vehicle Network Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!