文章目录
一、 cns 脚本自动标定值
在搭建好Ape 工程后,可以通过Ape中的Function 功能,添加脚本用于自动化标定
- 点击Tool
- 点击Function
1.1 新建脚本
- 选中Scripts 下,右键选择New
1.2 编写脚本
在脚本中可以直接操作A2L 中的标定量。语法与Capl 类似
前面是工程中Device的名称
1.3 编译脚本
- 选中Compile
- 点击Compile all
1.4 执行脚本
- 点击Online, 将Device 处于连接状态
- 点击Tool
- 点击Task Manager
- 点击Insert ,点击Start 运行脚本
或者直接在脚本编辑界面,点击Start Debug
二、 诊断报文
如果需要使用Ape 进行诊断测试,可以通过cdd 文件新建Device , 来实现Diag Console
2.1 添加Diag Device
-
在Device 界面,右键选择 New device
-
选择Diag 并且填写Device的名称
-
选择通道,添加Cdd 文件
2.2 添加Seed && Key dll
完成2.1中描述的步骤后,Ape 会自动弹出DiagConsole 界面。为了能够实现27 服务解锁功能。需要添加诊断安全算法制作的dll.
- 在Device Confiuration 中选中诊断对应的Device
- 点击protocol, 选中Diagnostics
- 在DLL path 中添加dll 文件
2.3 脚本发送诊断报文
建立诊断Device 之后,Ape 除了可以通过Diag Console 发送诊断请求以外。还可以通过脚本发送诊断报文,用于实现自动的诊断数据流。
可参考下面的语句
Diag_ReqMessage = H53_DIAG.DiagNewRawMessage(0x10, 0x03); /* 创建 10 03请求, 不需要带网络层参数 */
Diag_RspMessage = H53_DIAG.DiagSendRequest(Diag_ReqMessage); /*发送诊断请求 */
if (DiagIsResponseReady(Diag_RspMessage)) /* 检测是否收到响应报文*/
{
if (DiagIsPositiveResponse(Diag_RspMessage)) /* 检测响应报文是否为正响应 */
{
Write("Postive Response");
}
}
DiagDeleteMessage(Diag_ReqMessage);