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.2.tar.gz
(16.7 kB
view hashes)
Built Distributions
Close
Hashes for zlgcan_driver_py-0.1.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c382b54dc9814cef7370e6193806ed744c7e8f6a3ef51f097b17e821b4fcbd0d |
|
MD5 | 4ffae4f7dffb6e845a53945ce13f58c5 |
|
BLAKE2b-256 | 7af7cf7886f84c8bc7a0adf4e2cca5a44fd956cf91dc28c62228e155191e5709 |
Close
Hashes for zlgcan_driver_py-0.1.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 213178722b42ac1e997fa04d9fe1a29d76c83779bbed2c89660c1f94f1fbd1cf |
|
MD5 | 1352990e5db44955794a802053f382d7 |
|
BLAKE2b-256 | 63b9fe1c1457a1ba48d1312463ae4211f419600742d9bdb08e26b69a9e89e341 |
Close
Hashes for zlgcan_driver_py-0.1.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6674fbd101dcf10da8b136806bdced2295a7e02310fcafaccf79bf8af765953 |
|
MD5 | 9aa288dd5008bfedb9a8556949e3a779 |
|
BLAKE2b-256 | a503c859bb12aec22db82b495c428fc9cf507ed932fd9c431fc1687b59e1d0d9 |
Close
Hashes for zlgcan_driver_py-0.1.2-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07f120f6693715029700cd5771079264fba26c97c69923ed5e32b0cca2f717e9 |
|
MD5 | 38587e8e199b9c8b277e7574635985c8 |
|
BLAKE2b-256 | d2d7c16c18c02c4ba042e8e2c44a73f1b33c2071c2686efb61feea3a14d470ef |
Close
Hashes for zlgcan_driver_py-0.1.2-cp312-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d2ffdeadece8201055a5e04dee8292c40331441eab6e7f541e51057ea935a94 |
|
MD5 | 35f57c6eeae3a1a22c84011d2503c7b7 |
|
BLAKE2b-256 | 8e0f66d9a386edf14ae4e274571c6bfdea3b21d29895fc14dacc6554f4db8af6 |
Close
Hashes for zlgcan_driver_py-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac379d8ab5b90d85d16ea75dc3cacc639ed8e7e3036ef24cd454c7a78725f763 |
|
MD5 | f434e45dc7c172d4917deaba786b8239 |
|
BLAKE2b-256 | 6eed719bb1749d8e0659dec94887a38045bd5d5465bd878b2d2ddf2ea09a4fe0 |
Close
Hashes for zlgcan_driver_py-0.1.2-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 571e8d31eb640d8330ae512b7e9b5ab58e0b1d096090af692f37e5b7e1f41240 |
|
MD5 | d07685c026885c03ce48b9d2de7257c5 |
|
BLAKE2b-256 | 9121975a4e9f53d47cda2f5b0e1016acc08b0bde3d60f74ae65ea929b8c89658 |
Close
Hashes for zlgcan_driver_py-0.1.2-cp311-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35d579db9a1f0c2ddb565e65fc7993694c0a3b71752c99ed00f208e472f6d16c |
|
MD5 | 8d2d260c703286972852d9343008d494 |
|
BLAKE2b-256 | c33c44b8297b7b7cc56eeaec3626e96b90ade6beb25d55723c699ca461693827 |
Close
Hashes for zlgcan_driver_py-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95c3b5b294eb2809effc7d5da7a1b0f860e3de4351204869522d94afee610684 |
|
MD5 | 8f1fcbf03f043b31cd3d469846e00a6c |
|
BLAKE2b-256 | 0ce062af38ca7042738685faae91ae73e7db290370e6851b075281f51ec6853a |
Close
Hashes for zlgcan_driver_py-0.1.2-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6fc0b7880bdf473a516ca4faf732ae2a162fa139f2fd28fcd18c25ae84fa806 |
|
MD5 | 67b1bfde68b3061c66b042468377c250 |
|
BLAKE2b-256 | 1c6aba465abb90f8daf6d472f6b547e0ddd6ff3be32ecd1754cd09d7936d20e7 |
Close
Hashes for zlgcan_driver_py-0.1.2-cp310-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 766722ed3506b4f987b73ddd9cbec4ab480e29699b719f48c0e4df9bd327fb17 |
|
MD5 | 4df9ceabf08ae452c2db3bea60c4c1ab |
|
BLAKE2b-256 | a2c726ca2dcc48e0f18697f6a50846f4957e9eb0695c9182a50c2045ceffa44f |
Close
Hashes for zlgcan_driver_py-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6b579c55d9b4394812990769297281c67879d0d17a63a0ecdeb6b26c592f49e |
|
MD5 | 2122379f13d5fb2bb9ccf9e1dd98dae9 |
|
BLAKE2b-256 | acfc2ceefdbf3bb03554451dab7c74868eedbeffa7e85d525a8127e245b5ecc0 |
Close
Hashes for zlgcan_driver_py-0.1.2-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a5ff53b44f809eed9c6a9aeda03ffa5951430b854dc9840763db7d8ec6633f7 |
|
MD5 | 761cf97245cfbe6681cccad195e80669 |
|
BLAKE2b-256 | 95778f8516d3a2ad7296a3c088a78a377bee43f681a447ed01c1a928117ad5f2 |
Close
Hashes for zlgcan_driver_py-0.1.2-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89d3babd039919425be64549c9309899eb4d9a9651135011d1efb0cc583576d3 |
|
MD5 | b0b36b2dda075fce89f189f0479ac161 |
|
BLAKE2b-256 | b3062b86d5d98ad2382bea1f29671dceb92ccb6c60fa18b314505c99767b5301 |
Close
Hashes for zlgcan_driver_py-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ae0b76590ede6fdf387a3b1a539ae96de9c3f688a0bf42e692c607aaaec25c3 |
|
MD5 | 348c1447dea1088112d39061d5a6e2fc |
|
BLAKE2b-256 | f17680dffb47c53aed72c11e028dd78730bc6eead187e31c9331f6058ee9da6c |
Close
Hashes for zlgcan_driver_py-0.1.2-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 657c7bff7f253890c3cc509d6de510b50f6e0c83f4e38c3c9cf35a8bf24e00f1 |
|
MD5 | 54d6fd69a6512a68b50b77409742685c |
|
BLAKE2b-256 | 0174e590e4fc678ed1a6077a9860b9cdfd108695a273c3645aec46ad47b57d3b |
Close
Hashes for zlgcan_driver_py-0.1.2-cp38-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cac0e7b2bf524db8bbb1ef5f933867f81391b1f4a202b4c030fe3d5aab552ec |
|
MD5 | 83503ef0b2ffc57db6ce32b0885678ba |
|
BLAKE2b-256 | cefdcbee5591c9c3de391c455d1c2b1c7e899cef43b439433bbe13bbf00cbaa1 |
Close
Hashes for zlgcan_driver_py-0.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2b7f27342804a0a1e74e87cf877201122a02b5a282d51dc91c831b04a922f25 |
|
MD5 | 8456fb024cbb46e4903a8ad832868c97 |
|
BLAKE2b-256 | 4bdd8b511cda7bcae1329c0db630044d7ea4260e7a3c53d295ba5746ca7de780 |