CANoe教程 | C Library API

概述

CANoe/CANalyzer C library 简称CCL,允许用户使用C语言开发应用程序(dll),应用程序可以在CANoe/CANalyzer工程中运行。
CCL提供如下类似CAPL的功能:

  • 收发CAN、LIN报文
  • 定时器服务
  • 访问系统变量

如何创建一个CANoe/CANalyzer C library

  1. Create a new Win32 project for Visual C++ with the Project Wizard of Visual Studio and select the application type DLL when doing so.
  2. Copy the directory CCL together with the six files it contains (CCL.h, CCL.cpp, CCL.def, VIA.h, VIA_CAN.h and VIA_LIN.h) to the project directory of the newly created Visual Studio project. The CCL directory is located in Programming/C_Library when the CANoe/CANalyzer sample configurations are installed.
  3. Add the file CCL.cpp to your Visual Studio project and deactivate the use of the Precompiled Header for this file in the compiler settings of Visual Studio.
  4. If the Project Wizard created a source file with the DLLMain function, delete this function. Implementation of the function is already provided by the framework.
  5. Enter the CCL.def file in the linker settings of Visual Studio for the Module Definition File.
  6. If you add your own C file to the project, include the file CCL.h and implement the function cclOnDllLoad.
  7. Compile and link your project to receive your C library as a Windows DLL.

实际开发应用中我们可以基于CANoe提供的demo为base进行开发,从而省去上述创建过程。

CCL demo 一般在如下路径:
C:\Users\Public\Documents\Vector\CANoe\Sample Configurations 13.0.155\Programming\C_Library\Examples
CCL demo
双击CANoeCCL.sln打开例程:
例程包括CAN、LIN、Timer、SystemVariables等API的demo工程
![CANoeCCL.sln](https://imgconvert.csdnimg.cn/aHR0cHM6Ly91cGxvYWQtaW1hZ2VzLmppYW5zaHUuaW8vdXBsb2FkX2ltYWdlcy8yNDQ4NDQwMy1hNGVhNTc0MDY1NjRjZmRlLnBuZw?x-oss-process=image/format,png
CCL API的详细描述请参考CCL.h文件和CANoe Help 文档

如何加载生成的动态链接库

在CANoe工程中依次点击:
File -> Options -> Programming -> C Libraries -> Add
点击Add后在弹出的对话框中添加生成的dll
添加dll
点击CANoe工程Start按钮后dll会自动开始运行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值