LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HID interface with KM2805 MK-1

 Hi

I am working on Labview 16. I am trying to communicate with KM2805 MK-1 HID device using call library function node using  hidapi.dll. I need to read the Insulation resistance and the Voltage from the device. I tried putting vender id, product id and built  HID_Open.vi. It gives no error and also gives return type. 

But I am unable to  Read the data from the device it throws the error code 1097 . The device has USB port and when i searched it says its USB to serial device. 

When I connect the USB cable it get listed under "Human interface devices" as  "HID-compliant vendor-defined device". The Manufacturer provided only the software to log the data but no labview drivers or dll available.

When I contacted the Manufacturer they provided some  protocol and USB Test-N links which I downloaded. But I am not finding any clue to use them in labview. 

I am trying to build the driver  using "call library function node" but not succeeded. Please help in finding out the solution to read data from the instrument. I am attaching the downloaded files for the reference.  

 

Regards

Prasanna Kumar N M

 

0 Kudos
Message 1 of 3
(222 Views)

Can someone help me in solving the problem Please.🙂

0 Kudos
Message 2 of 3
(160 Views)

1) all the samples for the libusb-hidapi shared library require first a call to

 

int hid_init(void);

 

to initialize the HID library.

 

You should also call

 

int hid_exit(void);

 

before exiting your application.

 

2) Second, the handle returned by hid_open is a pointer sized integer, That is a 64 bit integer in 64-bit LabVIEW but a 32-bit integer in 32-bit LabVIEW. In the LabVIEW diagram it is always treated as 64 bit integer, but the parameter in the Call Library Node should be configured as pointer sized variable, otherwise your code misbehaves on 32-bit LabVIEW.

 

3) The string parameter to hid_open is a widechar string!!

 

hid_device * hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);

 

That are 32-bit characters under Unix/Linux and 16-bit characters under Windows. LabVIEW uses 8-bit local encoded characters for its strings!

 

You need to convert the LabVIEW string into a Unicode string before passing it to the function!

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 3 of 3
(143 Views)