Hi everyone,
I'm trying to learn about communication between USB and 18f4550. I've been trying for five days now and windows found unrecognized device, this is as far as i got
All what I'm trying to do for now simply is to turn LED on/off via USB that's it.
I'm using:
MikroC PRO v4.6
C# for the application
are there any books or already made projects i can learn from?
Thanks
E Nawar
USB 18F4550
- tihomir.losic
- mikroElektronika team
- Posts: 2138
- Joined: 02 Dec 2009 14:16
- Location: Serbia
- Contact:
Re: USB 18F4550
Hello,
you have our official USB example in our compiler,
and I will also attach them here with this post.
For any further instructions, feel free to contact us.
Best regards,
Losic Tihomir
you have our official USB example in our compiler,
and I will also attach them here with this post.
For any further instructions, feel free to contact us.
Best regards,
Losic Tihomir
- Attachments
-
- HID Read Write Interrupt.rar
- (9.76 KiB) Downloaded 643 times
mikroElektronika [Support team]
Re: USB 18F4550
Thank you Losic Tihomir,
the code is working just fine and once I'm finished with the C# application i will reply to my post
Thanks
E Nawar
the code is working just fine and once I'm finished with the C# application i will reply to my post
Thanks
E Nawar
Re: USB 18F4550
Please i need help!!!
Hi everyone, I tried the two examples of 18F4550 of MikroC PRO and both work. (HID Read Write Interrupt & HID Read Write Polling) after the Windows recognized the PIC, i tested it using HID Terminal in MikroC (tools >> HID Terminal >> Terminal tab)
i've send and received from/to the PIC
The circuit diagram:
capacitors 2x 22pF, 200nF, 0.1uf
resistors 470, 10K
Crystal Oscillator 8MHz The project sittings: the rest of the sitting are the same as the default sitting and the crystal should be 48MHz in the sitting (8MHz in circuit)
However,,,,,,, the PROBLEM is that i tried to rewrite the code of the example in a new project but it didn't work!!! i even used the same descriptor and i tried again with making a new descriptor didn't work. then i checked the examples' hex files and their size were about 16.6KB and the one i got after building the new project is 600bytes
then i tried to edit the example of MikroC itself and i build it and again i got 600Bytes hex file
did anyone face this problem before? how can i solve it? is there a mistake i'm making?
Thank you all
E Nawar
Hi everyone, I tried the two examples of 18F4550 of MikroC PRO and both work. (HID Read Write Interrupt & HID Read Write Polling) after the Windows recognized the PIC, i tested it using HID Terminal in MikroC (tools >> HID Terminal >> Terminal tab)
i've send and received from/to the PIC
The circuit diagram:
capacitors 2x 22pF, 200nF, 0.1uf
resistors 470, 10K
Crystal Oscillator 8MHz The project sittings: the rest of the sitting are the same as the default sitting and the crystal should be 48MHz in the sitting (8MHz in circuit)
However,,,,,,, the PROBLEM is that i tried to rewrite the code of the example in a new project but it didn't work!!! i even used the same descriptor and i tried again with making a new descriptor didn't work. then i checked the examples' hex files and their size were about 16.6KB and the one i got after building the new project is 600bytes
then i tried to edit the example of MikroC itself and i build it and again i got 600Bytes hex file
did anyone face this problem before? how can i solve it? is there a mistake i'm making?
Thank you all
E Nawar
Re: USB 18F4550
Hi everyone,
I used an older version of MikroC PRO and it worked!!!
maybe there is some problem with 4.6v
Thank you all
E Nawar
I used an older version of MikroC PRO and it worked!!!
maybe there is some problem with 4.6v
Thank you all
E Nawar
Re: USB 18F4550
Hi everyone,
Finally finished with the PC application, now I'm able to communicate with theUSB BUT, not using Visual C# 2010 instead I used Visual Basic 2010 and it's working great!!
This is the best site where anyone can start making their own application to communicate with HID USB
http://helmpcb.com/software/usb-hid-tem ... comment-59
Finally finished with the PC application, now I'm able to communicate with theUSB BUT, not using Visual C# 2010 instead I used Visual Basic 2010 and it's working great!!
This is the best site where anyone can start making their own application to communicate with HID USB
http://helmpcb.com/software/usb-hid-tem ... comment-59
-
- Posts: 23
- Joined: 08 Jul 2011 19:20
- Location: San Jose CA
- Contact:
Re: USB 18F4550
DOes anyone have Vb code to talk HID natively ? I mean using the windows HID functions. I do not want to use a third party 'mystery' dll like mchid. ( there are licencing problems. I don't know if i can distribute that dll with a commercial product. )
Re: USB 18F4550
Did you check out the page of Jan Axelson http://www.lvr.com/winusb.htm? I used it when I started with the PIC18F4550 and MS C#.
It uses the native HID driver as found in Windows.
It uses the native HID driver as found in Windows.
Fritz
Proud owner of EasyPic5, PICPLC16 V6, PIC32 MMB, PIC40 and registered mikroC PIC and PIC32 compiler.
Proud owner of EasyPic5, PICPLC16 V6, PIC32 MMB, PIC40 and registered mikroC PIC and PIC32 compiler.
-
- Posts: 23
- Joined: 08 Jul 2011 19:20
- Location: San Jose CA
- Contact:
Re: USB 18F4550
yeah. that is not understandable. that sample code tries to do everything at the same time... bulk , interrupt , threading .. overload !fweinrebe wrote:Did you check out the page of Jan Axelson http://www.lvr.com/winusb.htm? I used it when I started with the PIC18F4550 and MS C#.
It uses the native HID driver as found in Windows.
all i need is a few simple routines :
- pull the list of devices , filtered on vid and pid ( there can be more than one attached ... )
- retrieve the descriptors for each device in the above list.
- Open a device based on vid/pid and desciptor parameter ( serial number ). return a handle to this device.
- Send an array of 64 bytes ( one HID packet) to the handle (this must be blocking)
- Raise an event when a packet is received , packet is available as a string or an array of byes.
for example :
public devicelist() as integer
public lastdevice as integer
Sub FindDevices(vid as uint32,pid as uint32) : this populates 'devicelist' and sets 'lastdevice'
end sub
function GetDescriptor (deviceid as integer) as string : this fetches the decriptors from a device in the list.
end function
function Opendevice (deviceid as integer)
so i can write code like this :
finddevices(myvid,mypid)
dim myfirstdevice as integer = OpenDevice(devicelist(1))
dim myseconddevice as integer = opendevice(devicelist(2))
writepacket (myfirstdevice,x)
blabla
It doesn;t need ot be harder than that
Re: USB 18F4550
Yeah I understand what you mean. I am using UsbLibrary at the moment which can be found at http://www.codeproject.com/KB/cs/USB_HID.aspx (Had to find the link again).
You can also try these:
http://www.icsharpcode.net/opensource/sharpusblib/
Then there is this one http://www.florian-leitner.de/index.php ... r-library/. Make sure you look at his Blog as well, there is some good info. It is at http://www.florian-leitner.de/index.php ... r-library/.
Hope it helps
You can also try these:
http://www.icsharpcode.net/opensource/sharpusblib/
Then there is this one http://www.florian-leitner.de/index.php ... r-library/. Make sure you look at his Blog as well, there is some good info. It is at http://www.florian-leitner.de/index.php ... r-library/.
Hope it helps
Fritz
Proud owner of EasyPic5, PICPLC16 V6, PIC32 MMB, PIC40 and registered mikroC PIC and PIC32 compiler.
Proud owner of EasyPic5, PICPLC16 V6, PIC32 MMB, PIC40 and registered mikroC PIC and PIC32 compiler.