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.4.tar.gz
(16.7 kB
view hashes)
Built Distributions
Close
Hashes for zlgcan_driver_py-0.1.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d54b24cc2e626aca1105cf9f120db638dd4bd95c64228277d227ad0c57a795b9 |
|
MD5 | 45b92dc9f987e50a0d60305a18abfd09 |
|
BLAKE2b-256 | 055d5d45510e665e70818941b28d14f26bdce1351a199061586b3c193d1b3539 |
Close
Hashes for zlgcan_driver_py-0.1.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 876e4a852c4d46597f2dbc13b1ed116e4671fdef27e1d157d58d9fad56067e17 |
|
MD5 | 70b8da3b75f20bbf79875aa8aa8616fa |
|
BLAKE2b-256 | 44b15ec345a581b9a6995c99a3fe2315347ce8ef2f191c8ed0d0e2b92deb1ce7 |
Close
Hashes for zlgcan_driver_py-0.1.4-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75df12317f925389eb799a9e2866444409ec37109569777858059ddacfb27e6c |
|
MD5 | 30a8b5231ac96f2582ad3b1e3c7fab9c |
|
BLAKE2b-256 | d490c779a2762b16f6440c424616355bb3f6e220fe324b03ea081ad697c5e07e |
Close
Hashes for zlgcan_driver_py-0.1.4-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06237d578290b3ae3bd79cc1b1935b71a6068800758ed2c28f8ba90ca93b55aa |
|
MD5 | 9af3223a21e46159680ab6642884f68c |
|
BLAKE2b-256 | 4bbb245517f81d5368135188062c620bebf8ea42836c2c278f0f23050c4db171 |
Close
Hashes for zlgcan_driver_py-0.1.4-cp312-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41a36ae288c050b3fb5605b5a692692abd1a5264a9e26b3801ad50fb66a04b2a |
|
MD5 | 416d9eef7141b728bfa4a7ea3e5f42ae |
|
BLAKE2b-256 | a3a3eb315b5fc9c3f8769f6eed99182e2f516f39a111f8d7cc8c075c3b1b32dd |
Close
Hashes for zlgcan_driver_py-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6abb063ff727c132c6bac5e2bf44fe6f8342e34d92ebff93f6483f7c72b89e2f |
|
MD5 | 7902b2d67f892527696db76ea6732515 |
|
BLAKE2b-256 | 1709003e4054a56a53b99d424be87b910614df392b54a1ab26ba220dec5aa2c8 |
Close
Hashes for zlgcan_driver_py-0.1.4-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd147b5b1a830c88b9729d7acb3700d81624498b986133999ea7af40bcfb0f74 |
|
MD5 | ebaae16c8633a912445dd2dccda52c73 |
|
BLAKE2b-256 | 176bb09d97ff003c1de4a7aafbdba2fafcef15a0314d7cebdd0bd058b1770025 |
Close
Hashes for zlgcan_driver_py-0.1.4-cp311-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f67b7a88657b45aba13ffb9ce869eaeac68b9cb3592741e783ddc1c90af7a254 |
|
MD5 | 76801260a5d470cfbb6621a75d69ddf9 |
|
BLAKE2b-256 | b0c2b08c9830acd1ec9620bd2add443aca69df65a95b02e57052f603bb9364f1 |
Close
Hashes for zlgcan_driver_py-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 350b71ed364a9e06e96b7248052fb3ddca51b3408119c89fa40a8ac32781acb8 |
|
MD5 | 32c0e730549599728072bfc45b159a32 |
|
BLAKE2b-256 | 2e2d7c93265bce2795d0f3df65614c3d8d91f30fbc21ee3e390d866af37b58fc |
Close
Hashes for zlgcan_driver_py-0.1.4-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f37e73a4185b0f85311ce6b90187b0ad3b00683e3476ec657578506f6ff2ee5d |
|
MD5 | 899287d248ddae88fdb3aeadd316977f |
|
BLAKE2b-256 | 822c22c0311fc3bc2487fcdbc111ee88e75859f140897d75722dc552a6667ff6 |
Close
Hashes for zlgcan_driver_py-0.1.4-cp310-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1f8bb4917612cc75e63c25d8e8680a862f90519fe60a476900494bed6ab271e |
|
MD5 | a90772cd595cb53822004b04de475e9b |
|
BLAKE2b-256 | a7d381031bed3839a3865b24799ae46d75cc2c2c5b6c0c09abbeda4c642f819f |
Close
Hashes for zlgcan_driver_py-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cc1b32c93eee0650327fc5084ee54040d998049d13bdf4c374c81cb24494627 |
|
MD5 | 30db3275439319a8a6e35edaf224b1e9 |
|
BLAKE2b-256 | f910e5e8922b5fb5c0a7eb75add913557e08b6e04f20cb2370cd90c6a6ff0004 |
Close
Hashes for zlgcan_driver_py-0.1.4-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0f6b018082fee9792c4d89373eafeb94a238bd7f76d2fbe04b6cefbd3a164bc |
|
MD5 | 73f987334d5c02ae9a29c2093179c1cf |
|
BLAKE2b-256 | 7b1e44370aa4568304537e1a610b698cc0e0d544f108fbb03ef205d513a4ff66 |
Close
Hashes for zlgcan_driver_py-0.1.4-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 971cb64944a82b4c159d832fb986cfab78ed320f4ce44ac4a6d545ebc7cdc0f2 |
|
MD5 | b87f725d0372b97f67cf201eab290c75 |
|
BLAKE2b-256 | 8286e48a5df36f24da2fff8bce3b09076d2af8ef7e24c5327b8ba002253cd58d |
Close
Hashes for zlgcan_driver_py-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb8dcb3becb1691a283838b76d7684871b5f63f261a986811f5d74edfec1ceea |
|
MD5 | 19aa7e4a7d4e2534f75b52d3d57ab192 |
|
BLAKE2b-256 | 78a55cb8f086c8ae88bcff4db1a109b7e51c8d84172ef54c6b36a04bad02091f |
Close
Hashes for zlgcan_driver_py-0.1.4-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23cba77b05a56b1261a47fa3449fdc33eb249ab67ce8dabd8d41db00d4d2db4d |
|
MD5 | c385524402ebd24995e9372bd4168428 |
|
BLAKE2b-256 | 38592100ac15e34d68a4291261a193a31826396c735a9fd144d5503115684ece |
Close
Hashes for zlgcan_driver_py-0.1.4-cp38-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 874860e09ed448cacf959cd80d20a221bb56a16db1ee9ddacad54266be4d7d72 |
|
MD5 | a405f8d9a42fd1f2bd35a28186398732 |
|
BLAKE2b-256 | a4a2523344d68c8e2e2421bfaf11929c45c53b4a9bab07226a69d78d537426aa |
Close
Hashes for zlgcan_driver_py-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5aeacb24c85c355aae09a7dc910e6ebd05fdb8567b0f26e17ea30582515d296d |
|
MD5 | bf857620ecd7f4cced4f2da54fc5da0a |
|
BLAKE2b-256 | 6f4f531fe2be3919fdf8cbe7da0746bc05f4de3bce9c3f90bae2621abe238f6d |