CANoe:CAPL周期发送CANFD报文

文章目录

  • 一、关键设置参数
  • 二、操作方式
    • 1、插入CAPL脚本
    • 2、编辑CAPL脚本


一、关键设置参数

只要在定义message下面两个参数的值并设置为1时,即可发送CANFD报文
CANoe:CAPL周期发送CANFD报文_第1张图片

FDF:
If not 0, NM messages will be sent with FD Format indicator (FDF) equal to 1 (i.e. as CAN FD message).

BRS:
If not 0, CAN FD NM message will be sent with Bit Rate Switch (BRS) equal to 1.

二、操作方式

1、插入CAPL脚本

1)插入.can的capl文件
CANoe:CAPL周期发送CANFD报文_第2张图片

2、编辑CAPL脚本

variables
{
   msTimer myTimer; //定义计时器
}

on start
{
 
  setTimer(myTimer,10); //设置定时器时间
  
}
on timer myTimer
{  
  message * Msg;
  Msg.id = 0x1A1;
  Msg.dlc= 15;
  Msg.DataLength = 64;
  Msg.FDF = 1; //重点
  Msg.BRS = 1; //重点
  Msg.byte(0) = 1;  //第0个字节赋值为1;
  Msg.byte(63) = 1; //第64个字节赋值为1;
  output(Msg); //输出报文
  setTimer(myTimer,10);
}

综上,完成CAPL的CANFD报文代码编写,点击运行即可周期发送CANFD报文;

你可能感兴趣的:(CANoe,网络,汽车)