Usb Hid Terminal Program

Usb Hid Terminal Program 3,7/5 6524 votes

Realterm cannot read I2C without these external devices. It cannot use printer ports, the PC's SMBUS interface etc. The provides a USB/RS232 interface to 3 I2C buses. Realterm is an easy way to use it. Using the ActiveX interface you can easily send strings from excel or other apps. Usb Hid Terminal may sometimes be at fault for other drivers ceasing to function These are the driver scans of 2 of our recent wiki members.Scans were performed on computers suffering from Usb Hid Terminal disfunctions. Scan performed on 4/24/2019, Computer: Sun Microsystems K85AE - Windows 7 64 bit.

IntroductionWith the decline of serial and parallel ports from modern computers, electronics hobbyists are turning more to utilizing USB (or stick with old computers for their legacy ports). Unfortunately, unlike serial and parallel ports, USB is far from simple and so it can be daunting to try to develop hardware and software for it. However, there are many hardware and software solutions that make developing USB device much simpler.Some PIC microcontrollers now come with a USB Serial Interface Engine (SIE) that handles the very low level parts of the interface. However, writing firmware to work with the SIE can still be a difficult task. Luckily, many PIC compilers come with USB libraries that work out of the box and are dead easy to use. The code generated by these compilers tends to produce a USB Human Interface Device (HID) as these devices do not require custom drivers to be written because Windows has them preinstalled. However, you still need to write your own PC software to read and write data from your USB device.

This article shows you how to do this. Visual Basic TemplateThe Visual Basic template, which you can download at the bottom of the page, generates the basic code framework that is needed to interface with your USB device. All you need to do is set the VID, PID and buffer sizes going into and out from the PC.

After that you’re ready to read and write data.To give credit where credit is due, I did not write the code that is in the template – the code is based on the code generated by the EasyHID application from Mecanique and modified for Visual Basic 2005 by Steve Monfette. I modified his code a little, wrote some documentation and packaged it into a VB template. McHID.dll on 64-bit WindowsmcHID.dll is a 32-bit DLL and so can only be linked with 32-bit applications. Since all 64-bit versions of Windows come with the WOW64 emulator to run 32-bit applications, mcHID.dll will work on a 64-bit operating system but only if your application is compiled as 32-bit/x86. If you receive runtime errors such as “An attempt was made to load a program with an incorrect format” or similar messages, then make sure that you are not compiling your program to the “x64” or “Any CPU” configurations.

“Any CPU” configures your program so that it runs as a native 32-bit application on 32-bit Windows and runs as a native 64-bit application on 64-bit Windows. This means that the same executable compiled using “Any CPU” will work fine with mcHID.dll on 32-bit Windows, but will fail on 64-bit Windows. Make sure to compile using the x86 configuration.

InstallingInstalling the template is simple. Download and extract the archive and you will find two files: USBTemplate.zip and mcHID.dll. Copy USBTemplate.zip (copy the actual zip file – do not extract it) to your My DocumentsVisual Studio 2005/2008/2010/etcTemplatesProjectTemplates.Once a new project has been created (see below), mcHID.dll needs to be added to the Visual Basic project via the Solution Explorer.

Once added, change its Copy to Output Directory property to either Copy always or Copy if newer. This ensures that when the project is built, Visual Studio will copy mcHID.dll to the output directory that contains your executable.The template has been tested to work with Visual Studio versions from 2005 all the way to 2017. Using the TemplateAfter installation, load up Visual Basic and create a new project.

When the New Project dialog opens, you should see the USBTemplate option at the bottom.Select it, give your project a name and then click on OK. Visual Basic creates the basic code framework for you.The following files are created and can be found in the Solution Explorer:. frmUSB: This is the main form where USB communication takes place.

mcHIDInterface: Contains the underlying code. HOT TO USE: Contains instructions on how to use the template.The only file which you need to modify is frmUSB.NET VersionThe default.NET version in template is.NET 2.0. However, the template does work with newer.NET versions and has been tested using.NET 4.6. You can change the.NET version by right-clicking on the project in the Solution Explorer, clicking on Properties and then in the Application tab, change the Target Framework to the desired version. Updates2011/03/06: Modified the declaration of the PID and VID in the main form from Short to Integer (Thanks for Fred Schader).

DownloadThe template and the DLL file can be downloaded below. Hi John,Sorry for not getting back to you earlier.

It is possible to use the template to talk to multiple identical devices.At the moment, the code assumes that there is only one device. In any function calls that require a device handle (e.g. HidWrite, hidSetReadNotify) the code simply retrieves the handle by calling hidGetHandle. This will always retrieve the handle of the first device with a matching VID and PID.

If you have a look at the OnChanged function in frmUSB, you will see that the hidSetReadNotify function uses the handle returned by hidGetHandle, which means that the OnRead event will only get called when data is received from the first device you plugged in.In order to modify the code to allow you to communicate to multiple devices, modify the OnPlugged function to add the matching handle to an array or list somewhere in your code. Do the same for the OnUnplugged function but remove the matching handle from your array. That way, your array will always contain a list of the handles of the currently plugged in devices. Actually, your timing was great as your response confirmed the solution I had cobbled together.Due to the number of devices (6), I created a class for the device, placed the buffers and DataIn in that class as well as the pHandle, Serial and related stuff, and created a list to add and remove the elements with plug and unplug respectively. That way I don’t mix up data streams when interrupts come in. I had also modified away from the ‘Ex’ versions of the calls, which works as advertised.My thinking ran that, as long as I had separate datain and buffers, I should not have collisions when multiple devices were responding during a multi-part message – I would just route the data to the data in and buffer for the class instance and it should work.I did find that I needed to use a timer running a polling routine so I can hear from more than just the head of the pack.

It works great as long as all of the devices are connected before I start the application and I don’t remove one until I shut down. For some reason notification gets lost for the device next to the port that has a plug or unplug event. I’ve not sure if the handles are subject to change at this time.Is it possible for the pHandle for a connected device to change when another is disconnected?I also note that my devices are dual registered (Windows XP).

One set of handles has the serial number, the other the long integer Handle assigned by the system. Is there a way to access the serial number based handle, or do we need a different DLL for this? Alternately, can you help me decode the text and length requirements of the hidGetSerialNumber method?Thanks again for your support.

Great to have this resource available?-john. Hi John,Glad to hear that you’re making progress. I’ve done some more testing and what I’ve found is that every time you plug in or unplug a device, the OnChanged event gets called and the read notifications for all devices get removed. If you use hidGetItemCount and hidGetItem functions to list all of the HID handles you will find that they will completely change everytime a device is plugged or unplugged.

If you modify the OnChanged function to scan through the list of new handles, identify the ones that match your VID and PID (remove the code that does that from OnPlugged) and reenable their read notifications, then you will continue to get read interrupts for all your devices.Assuming that everything described above is working as it should, then it’s obvious that you can’t use the handles as unique identifiers. It certainly seems possible to use serial numbers if you can modify your descriptor to add one in (I’m looking into that). I have a bit of an update. It appears that, though I can see the new HID handle, set its readnotify to true and test that it is indeed true, I can’t get the interface to pass data from it.I have found a workaround, though. In the event of an unplug, I clear all of my buffers, clear my device list, then disconnect from HID, followed by a reconnect. The reconnect triggers the Plugged routine which populates my screen and seems to find all of the new handles.Now, this might pose problems for a history log, but I think I can deal with that by simply referencing the history log in a csv file by serial number.Does this approach raise any flags with you?.

Hi Luis,HID devices with multiple endpoints are not something that I have worked with previously. Looking through the list of functions in mcHID.dll, there does not appear to be any way of specifying which endpoint to communicate with.However, If you have a look at the Visual Basic code for reading and writing, you will notice that the first byte of the read and write buffers is always 0 (report ID). Perhaps changing this number could allow you to communicate with multiple endpoints, with the number specifying the endpoint number?. Dear Amr,I am trying to use your template and am having problems. I seem to be able to connect ok. I am getting OnChanged events and OnPlugged events.

However, I can’t seem to be able to write to the device.When I execute “hidWriteEx(VendorID, ProductID, BufferOut(0))” and use a USB device monitor, I see nothing happen. When I execute “hidWriteEx(VendorID, ProductID, BufferOut(1))”, I see some activity, but not enough – I see 2 bytes go out, not the 3 I had thought I was passing. Also, I don’t get a response (probably because not enough is being passed out)So I have a few pointed questions beyond “help”.1) How do I determine the correct value for BufferOutSize? Is it the number of bytes I am sending + 1? I need to send the device “C0 03 12”).2) How do I determine the BufferInSize?

Is this based on the expected response from the device?3) Do I need to interate through the BufferOut array?ThanksKevin. Amr,Thanks for the response. I am trying to work with a USB/HID RFID reader. AmrThe unit is called the RFID Me ( ).

If you send me an email to, I van send you the API doc for the reader.I am wondering if the unit has something weird as well. I know that their software, and another third party have successfully worked with it, but I am not a super strong programmer and wonder if it is just that.The resin was because the different commands result in different sized responses from the device. I was hoping that the wproblemwas the code was waiting for more from the buffer.Kevin.

Hey Amr,I am a student at the University of Colorado at Colorado Springs. I am using your template to communicate my vb 2010 program to an arduino uno via series 1 XBee modules. Looking at your template it shows how to read data into the pc but not send data out. My vb program will be sending out data not reading any incoming data.

(This is my first time using vb) Is there anyway you can show me an example code of a sub module for writing data from the pc to anything?Thanks for your timeDustin. Hey Amr,Thanks for the response last time, I went back and read the read me file again and again and came up with this:Private Sub CamPostion1Click(ByVal sender As System.Object, ByVal e As System.EventArgs)hidWriteEx(ByVal pVendorID As Integer, ByVal pProductID As Integer, ByRef pData As Byte) As Boolean‘This function is used to send data to the USB device. It’s usage is very simple:‘the BufferOut array (see above)‘is filled with the data that needs to be sent (make sure to set BufferOut(0)=0).‘After that, the function is called as follows:BufferOut(0) = 0BufferOut(1) = 0IBufferOut(2) = 1IhidWriteEx(VendorID, ProductID, BufferOut(0))End SubThe problem is that it is giving me expected errors in the hidWriteEx expression. What I am trying to do is send a single number (when a button is clicked) with XBee to an Arduino Uno that is why the sub CameraPostion1Click called then hidWriteEx is called after that. Any advice would be wonderful. Thanks for your time!Dustin. I was having a lot of trouble until I started using the template.

I have been able to successfully create a form that can communicate with my microcontroller.Is it possible for you to make a template for console application or provide instructions to use mcHID.dll in a console application? I am not an advanced programmer in Visual Studio so I was unable to figure it out. You current template works mostly based on events which is great when using it as part of a form.

I am trying to get it to work in a linear fashion such as:Check if device connected-Send Data-Receive Data. I need to transmit data from micro controller pic18f4550 to laptop via usb. At first just run ur program i had build errors likeError 2 ‘Sub Main’ was not found in ‘$safeprojectname$.My.MyApplication’.Error 3Character is not valid.C:UsersMMMDownloadsUSBTemplate-2011-03-06-16-34-00USBTemplateMy ProjectApplication.Designer.vb35 34 USBTemplate1Error 4 ‘Settings’ is not a member of ‘My’.C:UsersMMMDownloadsUSBTemplate-2011-03-06-16-34-00USBTemplateMy Projectusbvbb.vb 34 13 USBTemplate1Error 5Character is not valid.C:UsersMMMDownloadsUSBTemplate-2011-03-06-16-34-00USBTemplateMy Projectusbvbb.vb 67 55 USBTemplate1please help me to understand how solve these problems. Hi and thanks for the great tutorials.I used your template to try and connect to a PIC 18F2550.I can’t seem to be able to connect to the PIC although both VID and PID match the descriptor in my MikroC project.Do you have any idea what could cause that?Also, I am getting an error in VB 2010 when I try to send some data to the PIC. I create a simple button in the form which only does:BufferOut(1) = 255BufferOut(0) = 0hidWriteEx(VendorID, ProductID, BufferOut(0))the error (badformatimage.) says: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)It seemed pretty straight forward while reading your tutorial but I can’t figure out what I am doing wrong.Other than the same buffer size (which is 64 bytes) for both my descriptor and the VB form, is there anything else that must match in order for the communication to work?Thanks!Stephen.

Hi – could you, please, help me to fix the following problem?I connected USB scanner the USB port and I modified VendorID to &HC2E and ProductID to &H206 as determined by USB scanner.When I unplug or plug this device, OnPlugged or OnUnPlugged functions are called.When scanning any code bar – OnRead function is never called.What should be the pMsg value to be tested in WinProc function instead of WMHIDEVENT (which is good for NOTIFYPLUGGED, or NOTIFYUNPLUGGED and other cases)?Thank you in advance for your help,Andrzej. AmrThanks for your replyI Checked my Code and it is working properly(mikroC one).And after few experiments i got this result.My OnRead function is called but,what ever data i am receive from USB, i want it to be displayed on a TextBox Present at VB Form.For this i have declared a arrayDim USBDataReceived(BufferInSize) As ByteNow My OnRead Function is as follow:-Public Sub OnRead(ByVal pHandle As Integer)' read the data (don't forget, pass the whole array).MsgBox('Reading From PIC')If hidRead(pHandle, BufferIn(0)) Then'. YOUR CODE HERE.' first byte is the report ID, e.g. I’m not sure about this.

The hidWrite and hidWriteEx commands do not take any parameters that specify the size of the message. This would lead me to guess that they determine the buffer size from the device descriptor, thus meaning that the size of the messages sent to and from the device are fixed.I tried passing a single byte to the hidWrite command as follows:Dim ZeroMessage As Byte = 0 'Report ID is 0hidWrite(handle, ZeroMessage)Although this seemed to work (my devices indicated that they received a USB packet), I think hidWrite is sending more than one byte. For my test devices, the Buffer Out size is 64, and I reckon that after transmitting the contents of ZeroMessage, the function also transmitted the next 64 bytes in RAM that happen to be after ZeroMessage.Try it for yourself and let me know what you find.

Hi!tnx for this stable working, easy to use dll.I use it with VB6, it works great for writing, also reading raw data from EP0. But I don’t get the FeatureReport data.2 Questions:– can you add the getFeatureReport function?– I’ve got 2 devices with same pid, diff. I’ve choosen devices by GetItem, and got a handle, but there is still only the last device used.

How do I change the device? What shall I do with the handle, it’s not compatible with the usbdevicehandle.tnx in advancegaul1.

Thank you for such a fast reply.Actually i’m still stucked, i guess this is because this is my first work related to hid ^^Right now i’m getting 8bit info from my joystick and i can see clearly info from each buffer(0), buffer(1) buffer(2) buffer(3), buffer(8).Actually my question is related to the data itself.To take the example of your joystick, i guess i would guess something like this:buffer(2) is Throttlebuffer(3) is X-axisbuffer(4) is Y-axisbuffer(5) is Button 4Button 3Button 2Button 1POV HatIs it correct? In that case how can i convert buffer(2) to its real value, and also how to extract buffer(5) knowing that 5 values are inside.I guess it sounds pretty dumb, but i’m having trouble to find answer about this.Would love to get some help!Thank you. Hello all,i already use this DLL on many project with VisualStudio 2005 2008 and 2010now i reopen an old project under VS2010/win 7 x64 and framework 4.0i verify to compile only for x86 target as explain but now the project run and rapidly hang. I can exchange maybe 10 or 20 bytes between my board and the application and it hang with a “vshost32.exe” error message // nothing more!please anybody can confirm that my setup (win7 X64 / VS2010 / NET4.0) is working?thanks for any helpregards.

Hi Amr,Thanks for the code, its a life savor. Been searching for code like this for a week! I got everything working with the template. Was very easy. Would it be possible to have the same but for C#? I have tried some online converter but im getting all sorts of error.(‘System.Windows.Forms.Form’ does not contain a definition for ‘OnPlugged’ and no extension method ‘OnPlugged’ accepting a first argument of type ‘System.Windows.Forms.Form’ could be found (are you missing a using directive or an assembly reference?) and some others. I tried adding some ‘using’ but still no go.

Would you have any pointer on how it could be converted? I could send you what i already have if it helps.ThanksDominic. Hello, I noticed that if I connect my HID device and then I open my program (that uses mcHID.dll)) the HID device is properly recognized as connected but if I remove my HID device does not notice the change in the software. This problem only happens when I connect my device before opening the program. You wrote:You’re going to need to convert the string to an array of bytes, with each byte representing the ASCII code of each letter in the string. You can then pass that array to the hidWrite/hidWriteEx functions. Likewise, when the PIC sends data back, it will be sent as an array of bytes, and you’ll need to convert that to a string so that you can display it on your program.First of all thanks for your template posted here.

I tried and everything is working now but one thing I may need your help.I want to send a command of string to the microcontroller so I can get a response from it. I converted it to an array of Byte as you recommended and got an response of zero. It means that the micro controller got the command but wrong command. I think that is because it is a ascii command not the string command and the micro controller doesn’t understand. Do you have any advice here?

How can I make the micro controller understand the ascii commands? Thanks in advance for your help. Hi Tim,If you want to send a string to the microcontroller, then you need to convert each character of the string into its ASCII equivalent, put those values into the buffer array and then send that to the PIC, making sure to place a ‘0’ value at the end of the string.

For example, if you want to send the string “hello” to the microcontroller, then you need to fill your BufferOut array as follows:BufferOut(0) = 0 ‘. Thanks for your response.I tried with the value 0 at the end of the string but it didn’t work either.I am trying to send a string command to read the value of a micro controller. I converted it to ascii code, put them in bufferOut with bufferOut(0)= 0. When I called the function hidWriteEx(VendorID, ProductID, BufferOUt(0)), I got the value 0 from ReadOn Function. My question is:– How is the bufferOUt(1,2,3) sent out to the device? Do I need the codes for them?

Or they are sent automatically after BufferOut(0) is sent?Thanks for your help. Hi Amr,I am working with a thermo temperature sensor TMP006EVM using SM-USB-DIG from TI. They came in with data sheet and an interface software that I can install, run and get data. I can modify value of registers also.

But I want to play more with HID USB communication using VB to read data.So far I used a terminal interface to send command and get the data to make sure I have the right commands.(using I2C)For example, command “I2C CH1 ACKS OO ACKS S 81 ACKS R ACKM R ACKS P” and get response “FFC2” like I expected. Using your VB template I send this command and get a read of “0000” (I set BufferInSize = 4). I converted this command to ascci codes, put them in BufferOut, and call function ExWrite(VendorID, ProductID,BufferOut(0)) but only get values of 0000.I will review all codes and some spec from TI but want to understand the functionsExWrite(VendorID, ProductID,BufferOut(0))I just call this function and all elements in BufferOut are automatically set out to the device or I need more code to send out BufferOut(1, 2, 3). If you have any advice please let me know. Thank you very much. So I’ve had a quick look at the SM-USB-DIG, and I did a google search for “sm-usb-dig usb”.

I came up with the following forum post on the ti.com website:. The thread author is trying to communicate with the SM-USB-DIG on Linux and wants some information on the USB protocol it uses. One of the TI staff has posted the source code for the device, which you can download from the forum post.Now, if you have a look through the source code (particularly usb.c), you’ll find that the device does not appear to be receiving plain string commands (such as “I2C CH1 ACKS OO ACKS S 81 ACKS R ACKM R ACKS P”) directly over the USB. Rather, it seems to be receiving a binary packet.

My guess is that the terminal program you are using to test the device is not simply passing your string directly to the SM-USB-DIG – rather it’s parsing it, converting it to a binary packet format and then sending.that. to the device. And that’s probably why you sending the strings directly to the device is having no effect.In any case, have a look through the code yourself and see if you come to the same conclusion. Good Morning,I wrote the code that will receive the message sent by the pic but I get the following error message “Error vshost32-clr2.exe has stopped working”.When I tried to debug, Visual Studio Just-In-Time Debugger tells me that “A debugger is attached to myusb.vshost.exe but not configured to debug this unhandled exeption. Myusb is the name of my project.When I clicked ok and try to use the Visual Studio Just-In-Time debugger, I get the message “unable to attach to the crashing process.

A debugger is already attached.”How can I fix this unhandled exception?How can I dettach the vshost debugger?How can I use the Visual Studio Just-In-Time debugger?Or simply, how can I fix the problem?Please help me. Thank you, Amr.Phase one of the project is almost done.I’m faced with phase two now, scrolling message display. Hi, NesrineWhich lang are you using to program the pic? You will need a descriptor file that will hav the same vendor and product I’d as the one above. This will enable the vb application to detect that the device has been connected.Without the descriptor file, you may not be able to send anything from the vb app to the pic.If you are using mikroC pro, go to help and read about usb library, it will tell you how you will generate the descriptor file and will also tell you where to find the app that you will use to create the file.Hope that helps?. Hi,I try to read data from 2 HID devices using mchid.dll in vb.netI modified Onread function but it doesn’t work, the 2 textbox are changed in a same timeCan you held me?Public Sub OnRead(ByVal pHandle As Integer)‘.‘ on read event‘.‘ read the data (don’t forget, pass the whole array)‘If hidRead(pHandle, BufferIn(0)) Then‘. YOUR CODE HERE.‘ first byte is the report ID, e.g.

BufferIn(0)‘ the other bytes are the data from the microcontroller‘End IfIf hidReadEx(VendorIDdev1, ProductIDdev1, BufferIn(0)) ThenTextBox1.Text = BufferIn(1)End IfIf hidReadEx(VendorIDdev2, ProductIDdev2, BufferIn(0)) ThenTextBox2.Text = BufferIn(1)End IfBufferIn(1) = 0End Sub. I can’t communicate with PIC18F4550 FSUSB demo board. I am running Microchip’s HID-USB sample firmware code with this template. I changed vendor ID to 0x12 and product ID to 0x1 on both sides. I then added a simple text box on the form to inform me of a plugged and unplugged device by adding textbox1.text = “Device plugged in” in the OnPlugged subroutine.

Nothing is happening. Furthermore, when I exited this template VB app, I got an unhandled exception at the DisconnectFromHID function.

Usb Hid Terminal Program

Please advice. I am using the mchid.dll to control a MCP2210, the code I am using is Visual Studio 2013 VB. I have run into a weird issue. I have been unable to get the correct data in the SPI Read buffer by just using the HIDREADEX commanduntil during debug I placed a “messagebox.show” command in the code just before the HIDREADEX statement execution.

Timers, dealys, stoping the thread for countless seconds in the code do not work, only halting execution and requiring user interface seems to work. Any suggestions on how I could change my usage of the HIDREADEX function to avoid having to do this? Many thanks in advance.

I have tried everything to get the onread to work, but nothing ever triggers the onread, I can identify when my device is plugged in and unplugged and the handlers have been added through the dll, but nothing triggers the onread. I am using a standard barcode reader, which I simply want to capture the data. I am using 64bit windows 7. Everything seems to work with exception to the onread never gets triggered. I have even attempted to capture reads from my keyboard and again the onread never gets called. Any help would be much appreciated.

Hello Amr,I am experiencing a problem similar to the one described in message 104: I am trying to read data from a RFID reader (DORSET LID575 Trovan), but till now without success.The Onplugged, OnUnplugged and OnChanged events work perfectly, but nothing happens when I read the transponder. And when I put a MsgBox after each event in WinProc, only NOTIFYREAD remains silent.I know that my reader transmits correctly the tranponder IDs to the computer because I can read them on the DORSET’s program and with YAT too (like 00074F2C95 or 00074C07E7).I obtained the full device descriptor with USBTreeView (very useful free app.), giving a packet length (BufferInSize) of 8 bytes.

So my code to read is:‘.‘ on read event‘.Public Sub OnRead(ByVal pHandle As Integer)‘ read the data (don’t forget, pass the whole array)If hidRead(pHandle, BufferIn(0)) Then‘. YOUR CODE HERE.‘ first byte is the report ID, e.g. BufferIn(0)‘ the other bytes are the data from the microcontrollerDim i As IntegerFor i = 1 To BufferInSizelstReport.Items.Add(Chr(Val(BufferIn(i))))NextEnd IfEnd SubDo you have any idea why OnRead doesn’t answer. My OS is Windows 8.1, could it be the problem? Thank you advance for your help.Chering Parson. Please help meI used the above program in visual basic 2005 on windows 7 and 64 bits.I placed the vendor ID and Product ID which is set on micro-controller program.But, Unfortunately, When I run the UsbTemplate1 program there are some error on mcHIDInterface.vb:Error1: Option Strict On disallows implicit conversions from ‘Boolean’ to ‘Integer’.

On line pHostWin = hidConnect(FWinHandle)Error2, 3, 4, 5:Option Strict On disallows late binding. On line HostForm.OnPlugged(lParam) and HostForm.OnUnplugged(lParam) ad the line HostForm.OnUnplugged(lParam) and HostForm.OnChanged.Please help meI am really confused and I am beginner in visual basic 2005.Thanks in advance. No there is a problemWhy program runs but It doesn’t show in texbox1. Hi,Started using the lib.

Seems all good. One of my customers is using Win 10.My application is very simple.

All I am using the lib for is to play and pause media when headphones are connected and disconnected.OnUnplugged is called when the device is disconnected but when the return data from hidGetVendorId or hidGetProductId is random data. The correct VID and PID is not returned. The data is random. I get the occassional correct data, but 99% of the time it is random.I realise this is Windows 10 and a new OS, but has anyone had a chance to use on Windows 10?Many thanksRob. Hi Amr,I am using win8.1 & VB6.0 to read the HID device, Device plug and Unplug is working fine.

OnRead event is not generating at all. For your information: I am trying to read the Data from “In-size Gap Gauge instrument” that detects as HID device. When I focus the cursor on the text box the data is capturing.

But programmatically unable to capture the data. I am using Vb6, the mcHID.dll and code from your web site.Note: I had read your post above regarding 32bit and 64 bit OS. Is there solution to over come this because I need to use win8.1. Please help me in solving this problem.i.e VendorID = &H4D9 and ProductID = &H1702. I don’t know what this device is.

Can you share some more information about it? When you plug it in, how does it normally appear in Windows? Is it a HID Keyboard/Mouse?

Does it appear as a generic HID device? Have a look in Device Manager and see what category it falls under. The HID Template can only work with generic HID devices that fall under the Human Interface Devices category in Device Manager. If Windows sees the device as a keyboard, mouse etc, then it will handle reading and writing data to the device and the template won’t be able to. Hello, i wonder if this project can be used with my own form, not the default form “Form1”.

I am trying to integrate USB hid functions in my main form, called “StartingForm”. The error occurs on form load.Public Sub StartingFormLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadConnectToHID(Me)End SubMy Visual Studio points to the mcHIDInterface.vb file, function “WinProc” code line “HostForm.OnPlugged(lParam) and shows error “Public member ‘OnPlugged’ on type ‘StartingForm’ not found”. Any suggestions?. Hi Amr, it is me again (Fred Schader). Several years ago (I am the first post in the list, 2011) I wrote a nice control program for a signal generator. It has worked well for these 8 years.

This includes running on Windows 10 (see my second post). I have a new development machine and am finally upgrading from VB2005 to VB2017. The program runs fine including connecting but when I try my first hidWriteEx call the program hangs with no debug information. Have you had any experience running on the newer versions of VB, in particular VB2017?

If so do you have any hints?thanks. Hi Fred,I’ve just done a quick test, whereby I used mikroC to create a simple USB HID device using a PIC18F4550 that sets the status of PORTD via USB and sends the status of PORTB to USB. I then created a simple VB program in VB 2017 using the HID framework and that seems to work fine – I can detect connections and disconnections and I am able to send and receive USB data to the device. I even recompiled the program to work with.NET 4.6 (the default template.NET version is 2.0) and that works OK.Could share the code that called HidWriteEx, as well as the declaration of the write buffer please? Are you making sure that the first byte in the write buffer is 0?. Thank you Amr for the wonderful template.I’m new for VB and I’m using Visual Studio 2017 within windows 10 64bit.For the template, I am able to receive connect and disconnect events.

Also both event OnPlugged and OnUnPlugged are working fine. But OnRead event has never been fired. When I focus the cursor on the text box the data is capturing.The device is Omnikey 5427 CK reader and PID=&H5428 and VID=&H76B.Could you please let me know what the problem is, mcHID not support, need other handle, or others? Any comments?Thank you for your time.Colin. Hello All,well i’m using mcHID.dll since several years. Succefull from W7 to W10 (32 & 64bits) until several weeks.now, the same application (NO modification!) on W10 PC is not working anymore.on W7, it seem working again as expected.after several research on GG, i found that the problem may come from a recent update from Microsoft: September 10, 2019-KB4515384(.69i57j69i60l2.877j0j7&sourceid=chrome&ie=UTF-8 )Please anybody can confirm?

Can share any tips? Any solution!?i really need to provide W10 support, but i’m totaly stuck about this issue 🙁hope i d’ont need to rewrite the application!i try to uninstall the KB, but it’s not visible in tthe uninstall tab from W10. Only visible in the update list! Seem to be a big updateplease any adive, best regards.

Depending on the level of functionality you want to implement calling hid.dll with the Call Library Node may not be trivial at all and not enough too. If you want some user friendly device selection you likely will have to call some SetupDI API calls as well to enumerate the avialable HID devices and give the user a convinient selection list to choose the device from. Unless you wire the VID/PID combination into your code or require the user to provide them, but the second I would consider highly user unfriendly as most don't know what a VID and PID is.While access to the hid.dll is fairly straightforward, the SetupDI API is a pain to interface with the Call Library Node. In that case it is likely much easier to create a seperate DLL wrapper in C first, or go directly with the VISA variant, eventhough you have to implement the HID protocol yourself in LabVIEW when going the VISA route. Well agreeing that hid.dll is the best option is easy. Making it work however very difficult. I looked at some projects from the past where I had to interface to a HID device, and hid.dll is definitely not the holy grail.

In fact it is only a very small part of any kind of library that wants to interface to a HID device. A much larger part consists of acess to SetupDI. Functions in setupapi.dll to enumerate the installed HID devices and find the one of interest, retrieve the device name of it, then calling standard WinAPI functions CreateFile with that name to open the device driver, then using ReadFile and WriteFile to actually transfer the raw binary data. After that you call CloseHandle to close the device. There are several dozen Windows API calls to do, some of them rather complicated and a complete pain in the ass to do with the Call Library node.What I ended up in all cases, was writing an intermediate DLL in C, that did all this and exposed a small API to LabVIEW to be used. Unfortunately I can't post any of that code here. But I can not recommend this to anyone not able to write some real C code.

Ipi mocap recorder. You need to scan the QR code shown on the site using your mobile phone (or tablet) and perform the required actions on your device.In order to be able to scan the code, use the camera of your phone.

Thelow level C programming knowledge required to be able to interface some of those APIs with the Call Library Node directly is in fact greater than to simply writing some C code to call those APIs. That and the fact that maintenance of a C code file to access such APIs is much easier and cleaner than a LabVIEW VI doing horrondous memory acrobatics in order to be able to create the complicated data structures that some of the APIs require left to me no doubt which road to take.In any case you will have to read and understand C code and C API documentation in order to go the hid.dll path. One place to start would be to get some idea, then from there look for some C code samples, and finally read the MSDN documentation about the various APIs involved.

If you then find that writing a DLL in C to interface to these APIs is to complicated I can only advise you to forget to want to try to interface these APIs with the Call Library Node. The resulting code is much more time consuming both in creating and debugging it and also in later maintenance, than doing it all in C in a DLL. Micha,The posted ahidlib link from Sam Potter is as easy as it can get. It still doesn't solve the device specific communication itself but that is something you have to do on your own as it is. Device specific. HID is simply a standard in how to structure the downlink and uplink to the device.

What de individual bytes in those two streams really mean is very specific to each device, except in the case of standard HID devices like mice and keyboards.Most likely that is also the reason why Nate couldn't share his implementation since it implements the device specific protocol handling too, which his company most likely considers proprietary.

  • среда 15 апреля
  • 19