产品用户手册
接口函数使用手册
CAN/CANFD 接口卡系列产品
User
Manual
UM01010101 V1.13 Date: 2022/02/28
类别
内容
关键词
CAN/CANFD 接口函数库使用
摘 要
本软件可适用于广州致远电子有限公司出品的各种
CAN/CANFD 接口卡。接口函数库是提供给用户进行上位机
二次开发,可以自行编程进行数据收发、处理等。
CAN/CANFD
2
函数使用手册
修订历史
版本
日期
原因
V1.00
2019/01/09
创建文档
V1.01
2019/03/18
更新文档页眉页脚、“销售与服务网络”内容和新增“免责声明”内容
V1.02
2019/09/06
调整云设备数据结构
V1.03
2019/09/24
统一波特率设置,添加代码示例
V1.04
2019/10/14
USBCAN-2E-U 属性表的滤波项添加说明
V1.05
2019/11/19
属性表添加调用顺序说明
V1.06
2020/07/08
添加设备类型号定义
V1.07
2020/07/31
USBCANFD 设备添加延时发送队列清除功能
V1.08
2021/01/07
更新 CANFDNET,PCIECANFD 属性表
V1.09
2021/03/12
更新部分文字引用,更新部分设备属性表描述
V1.10
2021/05/13
添加 ZCAN_TransmitData,ZCAN_ReceiveData,ZCAN_SetValue,
ZCAN_GetValue 相关接口以及对应的数据结构说明
V1.11
2021/06/03
添加支持合并接收设备列表,更新合并接收 Demo
V1.12
2021/09/26
添加 PCIECANFD-100U/400U/MiniPCIeCANFD /M.2CANFD 设备支持
V1.13
2022/02/28
将 USBCANFD-800U 合并在 USBCANFD 模块集中说明,更新
PCIECANFD-100U/400U/MiniPCIeCANFD /M.2CANFD 部分属性
CAN/CANFD
3
函数使用手册
目 录
第 1 章 ZLGCAN 接口编程 ·································································· 1
1.1 简介 ····························································································· 1
第 2 章 开发流程图 ············································································ 2
2.1 普通 CAN 卡开发流程 ······································································ 2
2.2 云设备·························································································· 3
第 3 章 数据结构及函数接口定义 ·························································· 5
3.1 数据结构定义 ················································································ 5
ZCAN_DEVICE_INFO ··········································································· 5
ZCAN_CHANNEL_INIT_CONFIG ···························································· 6
ZCAN_CHANNEL_ERROR_INFO ···························································· 8
ZCAN_CHANNEL_STATUS ···································································· 8
can_frame ···························································································· 9
canfd_frame ······················································································· 10
ZCAN_Transmit_Data ··········································································· 10
ZCAN_TransmitFD_Data ········································································ 11
ZCAN_Receive_Data ············································································· 11
ZCAN_ReceiveFD_Data ········································································ 12
ZCAN_AUTO_TRANSMIT_OBJ ····························································· 12
ZCANFD_AUTO_TRANSMIT_OBJ ························································· 13
ZCAN_AUTO_TRANSMIT_OBJ_PARAM ················································· 13
ZCLOUD_DEVINFO ············································································ 13
ZCLOUD_USER_DATA ········································································ 14
ZCLOUD_GPS_FRAME ······································································· 15
IProperty 16
ZCAN_LIN_MSG ················································································ 16
ZCAN_LIN_INIT_CONFIG ···································································· 17
ZCANCANFDData ·············································································· 18
ZCANErrorData ·················································································· 19
ZCANGPSData ··················································································· 21
ZCANLINData ···················································································· 23
ZCANDataObj ···················································································· 24
3.2 接口库函数说明 ··········································································· 26
ZCAN_OpenDevice ·············································································· 26
ZCAN_CloseDevice ············································································· 26
ZCAN_GetDeviceInf ············································································ 26
ZCAN_IsDeviceOnLine ········································································· 27
ZCAN_InitCAN ·················································································· 27
ZCAN_StartCAN ················································································· 27
ZCAN_ResetCAN ················································································ 28
ZCAN_ClearBuffer ··············································································· 28
ZCAN_ReadChannelErrInfo ···································································· 28
CAN/CANFD
4
函数使用手册
ZCAN_ReadChannelStatus ····································································· 28
ZCAN_Transmit ·················································································· 29
ZCAN_TransmitFD ·············································································· 29
ZCAN_TransmitData ············································································ 29
ZCAN_GetReceiveNum ········································································· 30
ZCAN_Receive ··················································································· 30
ZCAN_ReceiveFD ··············································································· 31
ZCAN_ReceiveData ············································································· 31
ZCAN_SetValue ·················································································· 32
ZCAN_GetValue ·················································································· 32
GetIProperty ······················································································· 32
ReleaseIProperty ·················································································· 33
ZCLOUD_SetServerInfo ········································································ 33
ZCLOUD_ConnectServer ······································································· 33
ZCLOUD_IsConnected ·········································································· 34
ZCLOUD_DisconnectServer ··································································· 34
ZCLOUD_GetUserData ········································································· 34
ZCLOUD_ReceiveGPS ·········································································· 34
ZCAN_InitLIN ···················································································· 34
ZCAN_StartLIN ·················································································· 35
ZCAN_ResetLIN ················································································· 35
ZCAN_TransmitLIN ············································································· 35
ZCAN_GetLINReceiveNum ···································································· 36
ZCAN_ReceiveLIN ·············································································· 36
ZCAN_SetLINSlaveMsg ········································································ 36
ZCAN_ClearLINSlaveMsg ····································································· 37
3.3 设备功能和属性表 ········································································ 37
3.3.1 USBCANFD 系列(100U/200U/MINI/USBCANFD-800U) ··············· 38
3.3.2 PCIECANFD 系列(200U) ······················································ 52
3.3.3 PCIECANFD 系列(100U/400U/M.2CANFD/MiniPCIeCANFD) ········ 63
3.3.4 USBCAN-xE-U PCI-50x0-U 系列 ················································ 75
3.3.5 CANDTU-x00UR ···································································· 82
3.3.6 以太网系列 1 ········································································· 87
3.3.7 以太网系列 2 ········································································· 91
3.3.8 其他接口卡 ·········································································· 103
第 4 章 附录 ·················································································· 107
附录 1 - 设备类型定义 ·············································································· 107
附录 2 - 支持合并接收设备列表 ·································································· 109
附录 3 - 错误码定义 ················································································· 110
1
第1章 ZLGCAN 接口编程
1.1 简介
为满足市场发展的需要,广州致远电子有限公司推出了各式各样的 CAN(FD)接口卡,
例如 USBCANFD 系列、PCIECANFD 系列和 USBCAN 系列等等。除了必要的硬件支持,
更是配备了功能完善的分析软件 ZCANPro,给 CAN(FD)开发和诊断带来了很大的便利。
为满足接口卡接入集成系统的需要,公司推出了统一的编程接口,同时支持 CAN 和
CANFD。除了简单易用的接口,还配以接口使用例程和接口使用说明。本文档将对编程接
口的使用作详尽的描述,务必带给您更好的体验。
接口库以基于 window 系统的动态链接库(DLL)的方式提供,可实现设备打开、配置、
报文收发、关闭等功能。接口库采用 visual studio 2008 开发,依赖运行库 2008 版本,需要
确保计算机中已包含该运行库,否则可到微软官方网站下载安装。
如图 1.1 所示,资料包中包含了 zlgcan.dll、kerneldlls 和 zlgcan 文件夹,其中 kerneldlls
文件夹包含具体接口卡的操作库,zlgcan 文件夹主要包含 zlgcan.lib、zlgcan.h 以及一些其它
头文件,可参考使用例程使用。
开发编程直接加载 zlgcan.dll 即可,zlgcan.h 为接口描述头文件,zlgcan.dll 和 kerneldlls
文件夹需要放在可执行程序同级目录下。
图 1.1 资料包结构
评论0