Sonsivri

Electronics => Projects => Topic started by: jayanthd on September 02, 2012, 10:42:25 10:42



Title: PIC18F4550 USB VB.NET help needed
Post by: jayanthd on September 02, 2012, 10:42:25 10:42
Check this link.  http://www.edaboard.com/thread264350.html  (http://www.edaboard.com/thread264350.html) Please help me. I need some help coding the VB.NET app. The app will have 2 buttons. One to turn ON the led and another to turn OFF the led. There will be a text box and button to send text to LCD.

I need the VB.NET Code for that. I am using mcHID.dll for USB app


Title: Re: PIC18F4550 USB VB.NET help needed
Post by: koky on September 02, 2012, 10:58:01 10:58
http://www.circuitvalley.com/2011/09/pic-18f-usb-io-board-with-analog.html



Title: Re: PIC18F4550 USB VB.NET help needed
Post by: zed65 on September 15, 2012, 09:52:58 09:52
Do you need to use the HID.dll or can you use the USB to serial?


Title: Re: PIC18F4550 USB VB.NET help needed
Post by: dipchip on September 15, 2012, 10:36:39 22:36
I suggest you check out the MCP2200, it's very close to what your are trying to accomplish. (no analog input though)
There is a visual studio demo app/source that shows how to talk to the chip.  You can find it all on Microchip's website.
It might very well be what you need.

--Chip


Title: Re: PIC18F4550 USB VB.NET help needed
Post by: zed65 on September 16, 2012, 10:48:02 10:48
If you can use the USB to serial, have a look at my simple demo: http://www.sonsivri.to/forum/index.php?topic=43772.0 (http://www.sonsivri.to/forum/index.php?topic=43772.0)
You can easily modify it to do what you want.


Title: Re: PIC18F4550 USB VB.NET help needed
Post by: electrojit on September 19, 2012, 05:29:49 05:29
May be this can give you a start point...
http://code.google.com/p/winusbnet/ (http://code.google.com/p/winusbnet/)

Winusb with vb.net is really easy to use and simple example can be found here:
http://www.lvr.com/winusb.htm (http://www.lvr.com/winusb.htm)

And if you are working for winxp/7 32 bit... I guess libusb is also another option...

Regards,
electrojit


Title: Re: PIC18F4550 USB VB.NET help needed
Post by: Gallymimu on September 20, 2012, 07:11:45 19:11
HID should be a pretty easy approach.  I can't help you with the .net part of it though.  The other suggestions of using USB to Serial are pretty good ideas.  Low volume electronics development often use these parts since you can very easily program for serial on both the PC and microprocessor side.

The MCP2200 is a decent part.  The more commonly used part is the FTDI FT232R but FTDI has cheaper parts that have most of the same functionality FT230 and FT231 though they have had some silicon issues of late.  The nice thing about FTDI is that the drivers are ubiquitous. That said HID drivers are also ubiquitous... 


Title: Re: PIC18F4550 USB VB.NET help needed
Post by: Sisternicky on October 21, 2012, 10:20:18 10:20
I believe that your problem is to import the unmanaged myHID.dll into VB.NET?
If so, you can download the PInvoker Addin from www.pinvoker.com (http://www.pinvoker.com). It's a free plugin for Visual Studio that allows you to create PInvoke Calls to unmanaged functions and put them e.g. in a .NET Class to use with your .NET Programs.

To Communicate with HID is fairly simple. While I don't know myHID, the usual approach is:
  • Know your VID and PID
  • Your HID Wrapper can enumerate all the HID Devices with specified VID and PID on the bus, then select the correct one
  • Open the connection
  • Send / Receive predefinded HID packages

If you want to use CDC USB Class, the whole thing is even easier. You can use the USB CDC Driver provided by Microchip and register your device as "COM-Port". Then you can communicate as simple as with the serial port :).


Title: Re: PIC18F4550 USB VB.NET help needed
Post by: hbruno on October 21, 2012, 08:28:03 20:28
maybe, your response is here :
http://helmpcb.com/software/usb-hid-template-for-visual-basic-2005
also exist for VS 2010


Title: Re: PIC18F4550 USB VB.NET help needed
Post by: glenndr_15 on October 22, 2012, 05:17:41 05:17
Try to read Chapter 8 of the book "Advance PIC microcontroller - Projects in C from usb to RTOS with the PIC18F Series" by Dogan Ibrahim. In this chapter it will teach you how interface PIC18f4550 to PC using USB HID and teaches you how to use mcHID.dll.