现在阅读
USB Digital Multimeter Driver Using HIDAPI
0

USB Digital Multimeter Driver Using HIDAPI

由 ultracpy2018年1月26日

Introduction

The Victor 86B DMM is cheap and widely available (http://www.dealexcel.com/victor-vc86b-3-34-digital-multimeter_p1985.html)
and appears a great match for hobbyist projects.

Unfortunately, however no source code for the DMM app is available for the Victor application.
http://www.china-victor.com/Files/Download/setup_86b_multi.rar
and some of the application’s features such as saving to a .csv file do not work.

Although some other software for the Victor 86B is available, it is either closed-source
(http://homepage.ntlworld.com/green_bean/coffee/roastlogger/dmmdetails.html)
or incomplete and written in an interpreted language (http://www.daveansell.co.uk/?q=node/44),
therefore it was decided to build a driver program from scratch.

This driver program decodes and displays LCD output from a Victor 86B USB DMM data packet that has been accessed using
HIDAPI (http://www.signal11.us/oss/hidapi/) functions.

The program decodes and displays output from Victor 86B USB DMM based on HIDAPI
(http://www.signal11.us/oss/hidapi/).

The tables show how the USB HID packet (buf) decoded is reverse-engineered using a bench power-supply and other instrumentation to drive
the Victor86B as there is no specification available for the LCD control bits contained in the HID packet.

Background

All table entries are in decimal format and tables contain codes with and without the leading decimal point. In most cases, if 4 of one
on the two characters is set, this means that the decimal point is active.

LCD       digits           annunciators
        -   -   -   - 
       | | | | | | | | 
     -  -   -   -   -       M            Hz  
       | | | | | | | |   DC REL          V
        -   -   -   -    AC HOLD m oC u  A
          .   .   .
 buf  3,10 6,9 5,7 0,2   1  4    8 11 12 13

Digit 4 decode:

              .
LCD b3    b10  b10
0   33    79   95
1   17    111  127
2   65    15   31
3   97    239  255
4   81    175  191

Digit 3 decode:

            .
LCD b6      b9  b9
    0   47  69  85
1   31      101 117
2   79      5   21
3   111     229 245
4   95      165 181
5   239     37  53
6   239     69  85
7   31      229 245
8   111     69  85
9   111     37  53

Digit 2 decode:

                .
LCD b5      b7  b7
    0   54  84  100
1   38      116 132
2   86      20  36
3   118     244 4
4   102     180 196
5   246     52  68
6   246     84  100
7   38      244 4
8   118     84  100
9   118     52  68

Digit 1 decode:

            .
LCD b0  b2  b0
0   75      29  91
1   107     13  123
2   11      61  27
3   235     93  251
4   171     77  187
5   43      221 59
6   75      221 91
7   235     13  251
8   75      93  91
9   43      93  59

LCD Annunciator Decode:

//         M            Hz
//      DC REL          V  
//      AC HOLD m oC u  A  
// buf  1  4    8 11 12 13

if ((unsigned)(buf[ 1]& 16)) LCD_DC   = 1; // DC
if ((unsigned)buf[13]== 140) LCD_V    = 1; // Volts
if ((unsigned)buf[13]== 124) LCD_A    = 1; // Amps
if ((unsigned)buf[ 8]== 134) LCD_m    = 1; // m - milliamps
if ((unsigned)buf[12]== 126) LCD_u    = 1; // u - microamps
if ((unsigned)buf[ 4]== 177) LCD_REL  = 1; // REL
if ((unsigned)buf[ 4]== 241) LCD_HOLD = 1; // HOLD
if ((unsigned)buf[13]== 172) LCD_Hz   = 1; // Hz
if ((unsigned)buf[11]== 191) LCD_oC   = 1; // degrees C
if ((unsigned)buf[ 4]== 145) LCD_M    = 1; // Mega - ohms

Using the Code

The MS project file is provided as a complete example. It can easily be extended to dump results to a .csv file etc.

Points of Interest

If ever there was an argument for publishing open specifications for instruments with USB interfaces, this is it. A spec would have saved a few days
of experimentation to reverse engineer the storage format. Thankfully though, the HIDAPI library saved a lot of pain that would otherwise have been required
to interrogate the USB interface.

History  

  • Version 0.1. 

Update 

For those unable to source a Victor 86B a driver for the Victor 70C has been published at https://github.com/mvneves/victor70c by Marcelo Veiga Neves.  

The protocol for the 86B/C and 70C is described quite succinctly here http://sigrok.org/wiki/Victor_protocol

出处:https://www.codeproject.com/Articles/310547/USB-Digital-Multimeter-Driver-using-HIDAPI

关于作者
ultracpy
评论

你必须 登录 提交评论