概述
CANoe/CANalyzer C library 簡(jiǎn)稱(chēng)CCL候引,允許用戶(hù)使用C語(yǔ)言開(kāi)發(fā)應(yīng)用程序(dll),應(yīng)用程序可以在CANoe/CANalyzer工程中運(yùn)行季研。
CCL提供如下類(lèi)似CAPL的功能:
- 收發(fā)CAN飞主、LIN報(bào)文
- 定時(shí)器服務(wù)
- 訪問(wèn)系統(tǒng)變量
如何創(chuàng)建一個(gè)CANoe/CANalyzer C library
- Create a new Win32 project for Visual C++ with the Project Wizard of Visual Studio and select the application type DLL when doing so.
- 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.
- 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.
- 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.
- Enter the CCL.def file in the linker settings of Visual Studio for the Module Definition File.
- If you add your own C file to the project, include the file CCL.h and implement the function cclOnDllLoad.
- Compile and link your project to receive your C library as a Windows DLL.
實(shí)際開(kāi)發(fā)應(yīng)用中我們可以基于CANoe提供的demo為base進(jìn)行開(kāi)發(fā),從而省去上述創(chuàng)建過(guò)程蔚润。
CCL demo 一般在如下路徑:
C:\Users\Public\Documents\Vector\CANoe\Sample Configurations 13.0.155\Programming\C_Library\Examples
CCL demo
雙擊CANoeCCL.sln打開(kāi)例程:
例程包括CAN磅氨、LIN、Timer嫡纠、SystemVariables等API的demo工程
CANoeCCL.sln
CCL API的詳細(xì)描述請(qǐng)參考CCL.h文件和CANoe Help 文檔
如何加載生成的動(dòng)態(tài)鏈接庫(kù)
在CANoe工程中依次點(diǎn)擊:
File -> Options -> Programming -> C Libraries -> Add
點(diǎn)擊Add后在彈出的對(duì)話(huà)框中添加生成的dll
添加dll
點(diǎn)擊CANoe工程Start按鈕后dll會(huì)自動(dòng)開(kāi)始運(yùn)行