Hi
I have PIC 18f4550 and i want to use it for input device for my computer. I tried to programm my pic with sample program witch I have found in microC (under Help->USB HID library) but it seems that the sample program is not working. I have easypic4 and i'm programing pic via PicFLASH [v7.13]. What am I doing wrong?
I have 8mhz oscilator on easypic.
Thanks, Klemen
P18f4550 MicroC USB example problem
-
- Posts: 120
- Joined: 11 May 2008 18:47
Re: P18f4550 MicroC USB example problem
Hi,
I've checked HID-library and it works fine.
Check the manual for easypic4, maybe useful.
By the way, you must compile the program with 48M.
Be successful.
I've checked HID-library and it works fine.
Check the manual for easypic4, maybe useful.
By the way, you must compile the program with 48M.
Be successful.
- tihomir.losic
- mikroElektronika team
- Posts: 2138
- Joined: 02 Dec 2009 14:16
- Location: Serbia
- Contact:
Re: P18f4550 MicroC USB example problem
Hello,Klemen wrote:Hi
I have PIC 18f4550 and i want to use it for input device for my computer. I tried to programm my pic with sample program witch I have found in microC (under Help->USB HID library) but it seems that the sample program is not working. I have easypic4 and i'm programing pic via PicFLASH [v7.13]. What am I doing wrong?
please, can you check JP9 jumpers on your board (they should be on the right hand side for this example)?
If error persists, feel free to contact me.
Best regards,
Losic Tihomir
mikroElektronika [Support team]
Re: P18f4550 MicroC USB example problem
Sir,
I have built an USB circuit using PIC 18f4550.I used micoC and 8MHz crystal.it worked fine in the beginning.After sometime no device was detected in Windows.Can anyone help me to solve this problem.I am attaching the schematic and program
Thank you
Vikky
I have built an USB circuit using PIC 18f4550.I used micoC and 8MHz crystal.it worked fine in the beginning.After sometime no device was detected in Windows.Can anyone help me to solve this problem.I am attaching the schematic and program
Thank you
Vikky
- Attachments
-
- FINAL USB KEYBOARD PGMv1.1.zip
- (97.48 KiB) Downloaded 359 times
-
- Schematic.zip
- (13.2 KiB) Downloaded 288 times
Re: P18f4550 MicroC USB example problem
Go to this site and download USBDeview.
http://www.nirsoft.net/utils/usb_devices_view.html
Unplug your PIC from the USB port and then run USBDeview. Delete any instances of your device. Now plug your PIC back into the USB port and if it is working it should detected by windows and the drivers re-installed.
http://www.nirsoft.net/utils/usb_devices_view.html
Unplug your PIC from the USB port and then run USBDeview. Delete any instances of your device. Now plug your PIC back into the USB port and if it is working it should detected by windows and the drivers re-installed.
Re: P18f4550 MicroC USB example problem
Hi, I see some issues in the circuit diagram:vikky wrote:I have built an USB circuit using PIC 18f4550.I used micoC and 8MHz crystal.it worked fine in the beginning.After sometime no device was detected in Windows.Can anyone help me to solve this problem.I am attaching the schematic and program.
- C8 and C9 should be both 220 nF (Vusb)
- C1 should be 100 nF
- Between Vdd and Vss there should be somewhere a capacitor (elco) of approx. 100uF
- C6 and C7 should be surely not 1 nF, but much smaller, 15pF..27 pF (crystal).
- The PIC in the schematic is a 16LC64 in stead of a 18F4550.
Most probably the above issues are not as such present in the actual test board (it has worked...), only in the schematic.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Re: P18f4550 MicroC USB example problem
Dany makes some excellent comments. I did not look at the schematic closely before and have some additional comments.
Resistors R3 and R4 should be eliminated. There are internal pull up resistors in the PIC for these lines and it is best to use them.
Resistors R8 and R9 should also not be used. Not sure why they are there? You should connect the D+ and D- lines directly to the USB connector.
You really should have a 100 nF capacitor to GND at each VDD pin. Keeps these leads as short as possible.
I prefer not have an LED tied directly to the VDD line from the USB connector. I always put two LEDs on my boards both driven through a current limit resistor from pins on the PIC. I toggle one LED at about 500 mS from an interrupt to show that the PIC is running. The other is turned on when the PIC is successfully enumerated by the host PC and stays on as long as the connection remains. That way I can tell at a glance if the PIC is running and is connected to the host PC.
I also use a small USB hub that has LEDs to indicate when a device is actively connected on each port sitting next to my project to connect the device to the computer. If I do something really stupid and damage the hub it is easily replaced at low cost. The connection light is a quick and cheap indicator that the my PIC has successfully connected to the host PC.
Resistors R3 and R4 should be eliminated. There are internal pull up resistors in the PIC for these lines and it is best to use them.
Resistors R8 and R9 should also not be used. Not sure why they are there? You should connect the D+ and D- lines directly to the USB connector.
You really should have a 100 nF capacitor to GND at each VDD pin. Keeps these leads as short as possible.
That is much to big if you are powering your device from the USB port. The USB specification limits the total inrush current and 100 uF would far exceed that limit. Use a value of between 5 and no more than 10 uF and you will be right.- Between Vdd and Vss there should be somewhere a capacitor (elco) of approx. 100uF
I prefer not have an LED tied directly to the VDD line from the USB connector. I always put two LEDs on my boards both driven through a current limit resistor from pins on the PIC. I toggle one LED at about 500 mS from an interrupt to show that the PIC is running. The other is turned on when the PIC is successfully enumerated by the host PC and stays on as long as the connection remains. That way I can tell at a glance if the PIC is running and is connected to the host PC.
I also use a small USB hub that has LEDs to indicate when a device is actively connected on each port sitting next to my project to connect the device to the computer. If I do something really stupid and damage the hub it is easily replaced at low cost. The connection light is a quick and cheap indicator that the my PIC has successfully connected to the host PC.
Re: P18f4550 MicroC USB example problem
I did not know that. Thanks!w7ami wrote:That is much to big if you are powering your device from the USB port. The USB specification limits the total inrush current and 100 uF would far exceed that limit. Use a value of between 5 and no more than 10 uF and you will be right.- Between Vdd and Vss there should be somewhere a capacitor (elco) of approx. 100uF
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)