Invalid constructor signature for CAN message transmit
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello community,
I am trying to connect a PEAK USB system with matlab and send CAN messages to my hardware using MATLAB/SIMULINK environment. I have created a database for CAN messages called colibri_aktor. I generate a message and transmit from matlab but an error turns up. The example code and the error are attached below.
Any help is appreciated.
db=canDatabase('Colibri_Aktor.dbc')
messsage=canMessage(db,"nmt_start")
canch=canChannel("PEAK-System","PCAN_USBBUS1","ProtocolMode","CAN")
start(canch)
transmit(canch,message)
error message
Error using message
Invalid constructor signature.
Error in untitled (line 5)
transmit(canch,message)
0 commentaires
Réponses (1)
Aishwarya Shukla
le 3 Mar 2023
Hi @mehul,
It looks like there's a typo in your code. The variable messsage is misspelled and should be message. That's why MATLAB is throwing an error when you try to transmit it.
Try changing the second line of your code from this:
messsage=canMessage(db,"nmt_start")
To this:
message=canMessage(db,"nmt_start")
Also, make sure that the message "nmt_start" is defined in your Colibri_Aktor.dbc database. If it's not defined, MATLAB will not be able to create a canMessage object from it.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!