5

I'm trying to read voltages from a Tenma 72-7732 multimeter with a HID USB connection using PyUSB and libusb. This is my code so far:

def main():
    import usb.core
    import usb.util
    import usb.backend
    import sys

    #find device

    dev = usb.core.find(idVendor=0x1a86, idProduct=0xe008)

    # did you find it?
    if dev is None:
        raise ValueError('Device not found')
    else:
        print "Device found"


    dev.set_configuration()


    endpoint = dev[0][(0,0)][0]

    data = dev.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize, 0, 100000)

    print data

main()

This finds the device, but when it tries to read the data, it gives a timeout error. The multimeter has very bad documentation and support, so I can't go there for help. How can I read the device successfully?

4

1 回答 1

0

我使用一个简单的 IR 到 RS232 适配器,它由一个红外探测器组成,阳极连接到引脚 4,阴极连接到引脚 2(RX 数据)。当使用设置为 2400 波特、7 数据 1 停止、无奇偶校验、无握手的简单终端连接到我的电脑时,它会产生以下字符串

013651211

大约每 400 毫秒重复一次。前 5 位为仪表读数,第 6 位为小数点位置,第 8 位为功能位置

VDC = 1 AmpDC = 9

最后一位似乎是自动/手动与符号混合;其余的我不需要(还)。

于 2015-02-02T07:21:16.053 回答