Python wrapper for zlgcan-driver-rs.
Project description
ZLGCAN驱动及集成到python-can(因内存模型不同,目前Windows下32位python会报内存非法访问的错误)
-
安装python-can
pip install python-can
-
找到python-can安装路径
- windows下一般不用虚拟环境安装则在python安装路径下Lib/site-packages
- linux下一般不用虚拟环境安装则在用户home目录./locals/lib/PythonVersion/Lib目录下
- 使用虚拟环境则在虚拟环境下Lib/site-packages
-
修改python-can路径下的can/interfaces/__init__.py文件, 在BACKENDS字典中添加一行:
"zlgcan": ("can.interfaces.zlgcan", "ZCanBus"),
-
将
zlgcan
文件夹拷贝到can/interfaces/
文件夹下 -
安装zlgcan-driver-py库:
pip install zlgcan-driver-py
-
将libary文件夹及bitrate.cfg.yaml文件拷贝到当前工程根目录下
-
使用:
import can from can.interfaces.zlgcan import ZCanTxMode, ZCANDeviceType with can.Bus(interface="zlgcan", device_type=ZCANDeviceType.ZCAN_USBCANFD_200U, configs=[{'bitrate': 500000, 'resistance': 1}, {'bitrate': 500000, 'resistance': 1}]) as bus: bus.send(can.Message( arbitration_id=0x123, is_extended_id=False, channel=0, data=[0x01, 0x02, 0x03, ], dlc=3, ), tx_mode=ZCanTxMode.SELF_SR) # time.sleep(0.1) _msg = bus.recv() print(_msg)
-
CAN测试列表:
- USBCAN-I-mini - ZCAN_USBCAN1, ZCAN_USBCAN2
- USBCAN-4E-U - ZCAN_USBCAN_4E_U
- USBCANFD-100U-mini - ZCAN_USBCANFD_MINI
- USBCANFD-100U - ZCAN_USBCANFD_100U
- USBCANFD-200U - ZCAN_USBCANFD_200U
- USBCANFD-800U - ZCAN_USBCANFD_800U
-
注意事项:
- ZCAN_USBCAN1及ZCAN_USBCAN2类型的设备无论是windows还是Linux, 波特率支持均在
bitrate.cfg.yaml
中配置- 此时计算timing0及timing1请下载CAN波特率计算软件
- 其他CANFD类型的CAN卡仅仅在Linux上使用时
bitrate.cfg.yaml
中配置- 此时计算相关值可以通过
ZCANPRO
软件
- 此时计算相关值可以通过
- 在Linux上使用ZCAN_USBCAN1衍生CAN卡时, 请在初始化时候设置
ZCanDeriveInfo
信息 - 该库主要依赖zlgcan-driver-rs,如有问题,请提issue
- ZCAN_USBCAN1及ZCAN_USBCAN2类型的设备无论是windows还是Linux, 波特率支持均在
-
官方工具及文档:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zlgcan_driver_py-0.1.3.tar.gz
(16.7 kB
view hashes)
Built Distributions
Close
Hashes for zlgcan_driver_py-0.1.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb12e754d4c5a9f7e01eec1c1e30abe69218b7e56b74d8d836a5774d2602c8cb |
|
MD5 | 0483a4b3e6b1d987a8ba05ef34c4acba |
|
BLAKE2b-256 | 8a3a797da5a4e433effcf20e539a701a08845a04db15ea2e34a34897dc7cfe71 |
Close
Hashes for zlgcan_driver_py-0.1.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18a13b58a927fc056256818a3246644fff6b6506d5a600a67907c64bac2e4ee4 |
|
MD5 | d9f676e0cb1536626d4c51d11df61166 |
|
BLAKE2b-256 | 7557d7608f90f1581a75fb5b0258d4603c13c92fb663ee0ee8787b50485a77b9 |
Close
Hashes for zlgcan_driver_py-0.1.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0047c51552c692cb77b2d2b21a219191360ad14d7a3026c3b6c37d4ffb5b2e09 |
|
MD5 | e170177ec9cd87e483e0e3acd79e046e |
|
BLAKE2b-256 | bb228b1472450e61d1e66d10060268caabaf83b9b33da1d41c6a2e9fbc7f99b6 |
Close
Hashes for zlgcan_driver_py-0.1.3-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c12f0b99e116d5d7c906237949922145e646b4f0ce29ea46b91b3b50540cba8c |
|
MD5 | 51353e234e31ceafcf0aec908489e680 |
|
BLAKE2b-256 | fb40c5044a381d9ca4f3f13c26ac71ba49bc95d45221f721a8813e13933e6f04 |
Close
Hashes for zlgcan_driver_py-0.1.3-cp312-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3972d9eeb5b9b6996b9f6efed1f92b569e70d4ac9ea2e932569f4a076dd8ae2f |
|
MD5 | 13c8a07f654dcad38351ac7f8ad258aa |
|
BLAKE2b-256 | 8383c18aed0a52b71c0898d68178c14c6cb3fd60b1b9717cadfcb2e4f8e2dc6b |
Close
Hashes for zlgcan_driver_py-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5ea5f9a89604938525e9fb6f3388c99ec8fed8ffea3cd20479f15c362f12d43 |
|
MD5 | 84869ee133a1eab6c7b493c546b1600a |
|
BLAKE2b-256 | d46d9efc28826373f0053e1112a105c148532ca7f79fd1255eb6f69eeef265fe |
Close
Hashes for zlgcan_driver_py-0.1.3-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6a659ab43260ea6474203a611d886554ca20f913d59602324772c46dd36cc89 |
|
MD5 | 18c9896233188dd8678d24a45bac1838 |
|
BLAKE2b-256 | a9e0d7305caa0eb46f85bf6611169a25bd4b24fb63de338178417f2ad96731f2 |
Close
Hashes for zlgcan_driver_py-0.1.3-cp311-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7747c9005e2e95ed9a500d148c17e95dcbd6c7022c562ffc2fa0fcac83930cbb |
|
MD5 | cef16e82e35026c3e118471bdf4183e4 |
|
BLAKE2b-256 | c1ce62aa4bcb9a0b06228c749189a01819d793c39357f8df16ddb3a31fc5f407 |
Close
Hashes for zlgcan_driver_py-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99e123080883a5576db44f86ddc00b3188a11afdcab7b1f445ca5f95c09c578b |
|
MD5 | 26f293ded8d6e24ea4b69f744829ada6 |
|
BLAKE2b-256 | 991cfe90ec349a290e28f6e0fce36548d8812d757a507ab20c1c40fcb2837e56 |
Close
Hashes for zlgcan_driver_py-0.1.3-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3cc5def64e1f44744892539c3cc64d909a5e4ba808fcbc9100cee475d573525 |
|
MD5 | 0328edc60257540e369be16c368c2194 |
|
BLAKE2b-256 | e9de274e52c974d2629b94b44e108702586a3841992271418716f39d8c05000a |
Close
Hashes for zlgcan_driver_py-0.1.3-cp310-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40c62e3ded929ad8b5990e366e5d5a41c0e070f66d6eeabb13988a7df9693f7e |
|
MD5 | 10814d5ca279a8be519ab091a874432d |
|
BLAKE2b-256 | b6d892a7ef133410f3f017ddad650add6f79ec02a1e7d28a22be5e27e2ed04b7 |
Close
Hashes for zlgcan_driver_py-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b56b95893d36d2bf7c3f40560d342821b377a8ab8af8e4160e4effc40f641172 |
|
MD5 | 9af05e6223d7fb77b37a12be7465b1af |
|
BLAKE2b-256 | e46b217d8241ec51f0efd0acd753336c3c916c48c23e33040105d1394f93d38d |
Close
Hashes for zlgcan_driver_py-0.1.3-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a30c0465f20f5482b22757cda0cd85d8b5bd7faa722992fc5462e275a1aef3fa |
|
MD5 | 0c35fe8b1acc7c77419324ce1eadbaa2 |
|
BLAKE2b-256 | ee3714e68f146fe8cf285c90c014550a5b85fca187bc8c8d6f4afd8db58a362e |
Close
Hashes for zlgcan_driver_py-0.1.3-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bf93ab30f226220df97a4489b2b132d2f6d75d51e5fa7fefcb9f9b75d319976 |
|
MD5 | 7b0ce00bb824e5cb35db5ef307c3aa10 |
|
BLAKE2b-256 | 065f64fe80f0be5962a2d4d06b97ed77807b9f9fd1ddd45cce185a17c7dfbbc5 |
Close
Hashes for zlgcan_driver_py-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 235b0c77130c3ea548db09c2b8926498dc43172971ee900524c90a40525ff889 |
|
MD5 | d0d6537eafa4976bfb1d9d7a9bb3179b |
|
BLAKE2b-256 | 8844e8ca159dd0d939ccf266ecdff9f3f9cd9d5a22eb850d6af518ffe6705d32 |
Close
Hashes for zlgcan_driver_py-0.1.3-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05ba58ce2fa160367d8a0364db8bbc1fc08042f9bd46eb89310a5451ef6b3841 |
|
MD5 | c1d703b07eeefc4c4f6b6be645c749f9 |
|
BLAKE2b-256 | 42cb5a7f1b1cf7db64d68a60840a606075ce81a5731a70885c0a23435696b73f |
Close
Hashes for zlgcan_driver_py-0.1.3-cp38-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 889312663e79347f81c7720d387fdc3a13d1a49e5231c85bcd76512a4c0c2c36 |
|
MD5 | 6f9400827f8ab16c86811ec44a72aa92 |
|
BLAKE2b-256 | 1e05ec7335797b894aac0906810f0a51025526e539f74a4344f19edb2bfa71e0 |
Close
Hashes for zlgcan_driver_py-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab15d51dcb641bb0c2256d3f888eef54456ccdee4ad3af599e2c17a95b6323d9 |
|
MD5 | d2d6ccf0dd7ffc2cb0914c5a5558f965 |
|
BLAKE2b-256 | 0a4444dc9e290a2d34b26b258e22bd605e7f99bd2b14d9c64a69a48bf3dd581c |