我是CANoe中的新成员,也是CAPL语言。但我想问你: 如何在ECU的网络上用CAPL发送消息。例如:我想发送一个十六进制数(这是一个ECU的问题),然后我想看到这个问题的答案。发送消息/注入CAPL的消息
我不知道我是否非常清楚,但如果您有任何答案,我将不胜感激。
我是CANoe中的新成员,也是CAPL语言。但我想问你: 如何在ECU的网络上用CAPL发送消息。例如:我想发送一个十六进制数(这是一个ECU的问题),然后我想看到这个问题的答案。发送消息/注入CAPL的消息
我不知道我是否非常清楚,但如果您有任何答案,我将不胜感激。
下面给出可以使用,
variables
{
message BCMmsg01 msg_BCMmsg01; // declaration of message into a variable
}
on key 'z'
{
msg_BCMmsg01.C_AutoLockCmd = 3; // assign the value to the message
output(msg_BCMmsg01); //send the message to the CAN bus
}
希望我澄清你的问题。让我知道你是否需要更多的澄清。
乔显示了消息(在这里是十六进制值)的发送方式。如果你想看到的响应,你需要知道的响应ID(例如0x62C)
on message 0x62C /* This is the identifier of your response */
{
if(this.byte(X) == 0xYY) { /* X is the byte of the response you are interested and Y the value of that byte*/
write("Response is the expected!");
}
我希望这回答了你的问题。
在CAPL发送邮件
您可以在任何情况下发送的消息(或多个消息), 例如,按键,另一消息的接收,错误帧的接收,或定时器到期。 发送事件消息包括创建事件过程,声明消息发送以及在事件过程中发送消息。 可以将消息声明为全局变量,以便可以在任何事件过程中访问该消息。 如消息对象部分所示,您可以在程序中声明消息的结构,也可以使用关联的数据库。 在这个例子中,我们将宣布各自的全局变量窗口之一现在
variables
{
message EngineData msg1; // Defined in database
message 0x101 msg2; // Extended message 101 (hex)
}
,发送消息,我们只需要把这些行的一进一出事件过程:
output(msg1);
output(msg2);
当然,我们也可以在发送消息之前添加数据。 EngineData消息在数据库中定义了信号,但其他消息没有。因此,我们必须使用两种不同的方法将数据添加到消息中。
msg1.EngSpeed.phys = 1000;
msg1.EngTemp.phys = 150;
msg1.IdleRunning = 1;
output(msg1);
msg2.DLC = 4; // Allocate 4 data bytes in msg2
msg2.byte(0) = 0x16; // First word is 16 hex
msg2.byte(1) = 7; // Second word is 7 decimal
output(msg2);
响应信息
on message 0x101 /* This is the identifier of your response */
{
if(this.byte(0) == 0x16)
{
write("Response is the expected!");
}
}
或
on message msg2 /* This is the identifier of your response */
{
if(this.byte(0) == 0x16)
{
write("Response is the expected!");
}
}
虽然我同意这是更友好,要求对计算器的办法是避免 “谢谢” 一般。这是隐含的。 “我不知道是否清楚......”。相反,您可以稍后编辑自己的问题,但您看到的内容不明确。这样更好:它是活的! – Heyji