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.1.tar.gz
(16.7 kB
view hashes)
Built Distributions
Close
Hashes for zlgcan_driver_py-0.1.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09fbf4d6ae780056efc7c7a791649f8abebb0285b1de74c2470ffca171f0a80f |
|
MD5 | bdc054e2a8ae852bef609e46f46e80dd |
|
BLAKE2b-256 | 0be59d08ebbec33511b7c72cddbc0c97b0055f0b09e67c64812f6568bb540f94 |
Close
Hashes for zlgcan_driver_py-0.1.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c3e0d509144189fa22c178f8eb8a37f6b3a7aeec19bd1e9a9acd021143f6e3c |
|
MD5 | 26109092a13f34b654f3face7268e5da |
|
BLAKE2b-256 | 7760abb447c9c53a0fb028a16c7f57cbc70abe2e24a3a18a592378dbca467810 |
Close
Hashes for zlgcan_driver_py-0.1.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6896dc3dce456a87feda75bd5b969b399c6f738f4edd2ac94b9601e8351c6430 |
|
MD5 | a0975d2c8f9a1e4ac0d5e5278ee5c667 |
|
BLAKE2b-256 | 601284adcbc31ed7629ceedc09a8138538c62ddcf8c21a5b228f959c8b15caa5 |
Close
Hashes for zlgcan_driver_py-0.1.1-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a7377bb8783ad5248641033db3edc138dea87400dd6a561de7a0caba71d4adf |
|
MD5 | 3aac0dfdb152f06df129848e3d2d6164 |
|
BLAKE2b-256 | 8d16c7b1a91cc992ab8a58d703d267aad68a4d0b42162610ca73b903a85f0aef |
Close
Hashes for zlgcan_driver_py-0.1.1-cp312-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8d611b594dd83a651496e3cf62e92ed99f8aa2619a60a15541c710519f13f7c |
|
MD5 | 1fa63a056d0c6500848865d28d815924 |
|
BLAKE2b-256 | a3b33d3c158dec71b6f7be0235c0ddaa879301b57e2be2912b4ce6ea3081b851 |
Close
Hashes for zlgcan_driver_py-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfba641f423b6b730cec1564d4f543f317767f485f85fd3b6cf3179c0e8dcb09 |
|
MD5 | c8b8a0d67708b319169258eea563d9d1 |
|
BLAKE2b-256 | b12330f3e3c583a5df6fbc382bee071f31428396977243f5a5016c7ce384ce5e |
Close
Hashes for zlgcan_driver_py-0.1.1-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3b4a21e864ea4d7703bd738e70f27653de2acdf16e187089523143d6dc7a4ae |
|
MD5 | b5d73ce2eff0fed3d98afddad172812d |
|
BLAKE2b-256 | 708a3850320a69ef4d00c66077a397f07b4a6750072f7cd7edf808503b13f93f |
Close
Hashes for zlgcan_driver_py-0.1.1-cp311-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f78f1c6a01804c12b7c9a3cc016c7e87441dfd10f87ed40c156611d3d3faaa31 |
|
MD5 | d8a271b8822e7c2ade6e180cc67e5a24 |
|
BLAKE2b-256 | f2f7b2d2a1eae989328ea5d3ac481ed6386a03139d49f1f58845b497c28a1203 |
Close
Hashes for zlgcan_driver_py-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dce78c2e416e408209e1f560481ec8b10c92e44ea72cade8658fb94e30e85da9 |
|
MD5 | a32e1a7123512a30d5ce082017518567 |
|
BLAKE2b-256 | 4c4d3f6ee0ea86e21121ca0077eb0632b3a14daa3d66ccf79f38f044d1e4b230 |
Close
Hashes for zlgcan_driver_py-0.1.1-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16f83657fccab0162d8b938343ca6dcfbfdc5cf86cb821d37bd277f2b4ed8869 |
|
MD5 | db9407a9e0c0c0add4b6386a3215ea25 |
|
BLAKE2b-256 | 507fd9df207771a73cff6912c82acb0e57dbf988b001039510e8e9f4083ba411 |
Close
Hashes for zlgcan_driver_py-0.1.1-cp310-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee919063519168967ad3eebc9e682114d2195f355cbba8b584472e5b33a5c18e |
|
MD5 | 8ea19aff30896a19fb4e24caea9cdcf6 |
|
BLAKE2b-256 | 8380124442bdcdafb5c8d1bd0daac0a32d5514f9ff681986decfc7f8a9056b2e |
Close
Hashes for zlgcan_driver_py-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a904179af63eefa836d33cba492f405be12bb61b50cdf1ee0ecbd8c5b8a5887 |
|
MD5 | 180b576bac1e0bdb7d898b2bf726deb2 |
|
BLAKE2b-256 | 9921e8407be75d24e5c69092fac034f8d29fecbff820c91fa0cb08631b0a47f9 |
Close
Hashes for zlgcan_driver_py-0.1.1-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21a767080ba5017c01229bd583a8502a7ec2acc36ee68ffb51ca2a7013e54bcb |
|
MD5 | 528442bdb2b474b3405ad8dfd1a968dd |
|
BLAKE2b-256 | 498abde5f654e4ce7facf601708af976bcb8169c5fecbbbd186dd28d66fc279d |
Close
Hashes for zlgcan_driver_py-0.1.1-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e5db309119428fba9864309f38e2c55679e01fba56d6c20083813ff3eb70217 |
|
MD5 | 1f3fa5de91b1eb90a7c9f18a98afd162 |
|
BLAKE2b-256 | 626c1e56ad7e5a42545e21caf700e894378ca84186398441cb8f6711cf562ca6 |
Close
Hashes for zlgcan_driver_py-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fcd495d33f26c9374b1ee2fd9687122952ba7d12fce585975a07225f15d9dbf |
|
MD5 | 369c78f05e6c4ca43f5c952367add352 |
|
BLAKE2b-256 | aeac11947dd8d34823031354867b0b222460915acf1cfe999d3d0cb8351335fc |
Close
Hashes for zlgcan_driver_py-0.1.1-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a841512ebc1731ed7d3c3e3cbb7c81b7d95cfa91412fe64adf2cf6d43b09f769 |
|
MD5 | 43037cfd3664638a2a25ca10d3fd42ff |
|
BLAKE2b-256 | b61594ffef8d132fef5797eee6fab950b7d4a0f27dd87fdb5a21bcdf00c35166 |
Close
Hashes for zlgcan_driver_py-0.1.1-cp38-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe168b6ebf803d9b67a4fb21c6110ad334d9693586675170c30316bd2b5de45c |
|
MD5 | 038f91345355a1b50b4155e39712e0aa |
|
BLAKE2b-256 | 69e7309b67049907a5345b5122686a68ff7dafe5b76e354b7d1238493baa3359 |
Close
Hashes for zlgcan_driver_py-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a975d93f63f86e05713e15f68c6d83b6f958af5799baaf9f6e8a6938c49a1796 |
|
MD5 | c160af934f025c963f2331d4e5fcd245 |
|
BLAKE2b-256 | 4ff58be7db6f29a82e804581ee1542cb955ab921d67178e8063fd5b3af3594a8 |