Is it possible to send CAN messages out of a callback function?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!