![](/img/trans.png)
[英]How to modify message data in CAPL if message is generated by Interactive generator block?
[英]How to access Interactive Generator block (IG) in Vector CANoe CAPL?
我想访问CAPL中的IG块,例如激活/禁用消息发送,设置信号值。 但是我没有找到这种capl函数。
您需要在CAPL中声明您自己的消息,然后应该使用函数“输出”在CAN上发送它。 下面的示例以100ms的周期发送ID为0x100的消息。
enter code here
variables
{
msTimer timer200ms;
msTimer timer100ms;
message 0x100 msg = {
DLC = 8,
byte(0) = 0x00, byte(1) = 0x00, byte(2) = 0x00, byte(3) = 0x00,
byte(4) = 0x00, byte(5) = 0x00, byte(6) = 0x00, byte(7) = 0x00
};
byte myByte[8];
}
on timer timer200ms{
int i=0, j=0;
if(i<7){
if(j<256){
myByte[i] = j;
write("frame %d have been change for %d", i, j);
j++;
if(j==255){
i++;
j=0;
}
}
}
else{
cancelTimer(timer200ms);
}
}
on timer timer100ms{
msg.byte(0) = myByte[0];
msg.byte(1) = myByte[1];
msg.byte(2) = myByte[2];
msg.byte(3) = myByte[3];
msg.byte(4) = myByte[4];
msg.byte(5) = myByte[5];
msg.byte(6) = myByte[6];
msg.byte(7) = myByte[7];
output(msg);
}
on start{
setTimerCyclic(timer100ms, 100);
setTimerCyclic(timer200ms, 100);
}
您必须在按键上做一些功能,或者将功能连接到面板,IG只是发送消息的一种更简单的方法,但是您不能将capl与IG连接,因为它们是不同的节点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.