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
}
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!");
}
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);
Responding Message
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!");
}
}
3 回答
你可以使用下面给出的,
希望我澄清你的问题 . 如果您需要更多说明,请与我们联系 .
Joe显示了消息(在本例中为十六进制值)的发送方式 . 如果要查看响应,则需要知道响应ID(例如0x62C)
我希望这回答了你的问题 .
Sending message in CAPL
您可以在任何事件上发送消息(或多个消息),例如,按键,接收另一条消息,接收错误帧或计时器到期 . 发送事件消息涉及创建事件过程,声明要发送的消息以及在事件过程中发送消息 . 消息可以声明为全局变量,以便可以在任何事件过程中访问它 . 如消息对象部分所示,您可以在程序中声明消息的结构,也可以使用关联的数据库 . 在这个例子中,我们将在Global Variables窗口中声明其中一个
现在,要发送消息,我们只需要将其中一行放入事件过程中:
当然,我们也可以在发送之前向消息添加数据 . EngineData消息具有在数据库中定义的信号,但另一消息没有 . 因此,我们必须使用两种不同的方法来向消息添加数据 .
Responding Message
要么