Is it possible to send CAN messages out of a callback function?
2 views (last 30 days)
Show older comments
Hello,
I have following problem: I would like to send CAN messages out of a callback function. This callback function is called by an timerobject. Everytime when the callback function is executed it should send the CAN message.
I coded:
canch = canChannel('PEAK-System', 'PCAN_USBBUS1');
configBusSpeed(canch, 1000000)
start(canch)
canch.Database = canDatabase('\\psf\Home\Desktop\02 CAN DBC\CAN4.dbc');
message = canMessage (canch.Database,'IPSS_RX_1_1ms');
transmitPeriodic(canch,message, 'On', 0.01);
T= timer('ExecutionMode','fixedrate','Period',0.2,...
'TimerFcn',@TEST_timer_callback_fcn,'StopFcn','disp(''Timer has stopped'')');
start(T)
Callback function:
function TEST_timer_callback_fcn(src,event)
message.Signals.In_ti= 39;
The CAN Channel starts - but the message is not send.
Can somebody help?
0 Comments
Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!