Warning: mysql_connect() [function.mysql-connect]: Access denied for user '212573_tcwdata'@'22.214.171.124' (using password: YES) in /srv/disk3/212573/www/pwc.theclarkwebsite.com/PIC18F4550usb.php on line 14
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Warning: mysql_close(): no MySQL-Link resource supplied in /srv/disk3/212573/www/pwc.theclarkwebsite.com/PIC18F4550usb.php on line 23
Simple PIC18F4550 USB Circuit
Simple PIC18F4550 Circuit
One note before I get started - I rencently wrote another piece about using the Microchip MCP2200 for USB communications. If you are just getting started, or only need serial communication with a computer, I highly recommend you take a look at that chip. Click here for that tutorial.
I wanted to write a quick tutorial of how to make a simple PIC18F4550 circuit to act as a human interface device (HID) for USB communication without using the demo board (PICDEM) supplied by Microchip. I was a bit intimidated by USB communication at first, but it is actually pretty simple if you know a little about microcontrollers and the C programming language. I have minimal knowledge of both (as I am an accountant) but was able to get it working quickly with few external parts and Microchip's firmware files (MCHPFSUSB v1.2), found here
. The key is to alter the firmware supplied by Microchip in three places to work with your circuit instead of the demo board. The 18F4550 will be powered from the USB, using the following circuit:
22pf capacitors (2)
470nf capacitor (1)
100nf capacitors (2)
USB Connector (Type B)
The capacitors between VDD and ground are critical to making the 18F4550 operate properly. Without it, the PIC is very erratic, if it works at all.
Changes to the firmware are as follows:
1. Turn MCLRE OFF in the "main.c" file Ė the demo board has a button that sets this pin low, which resets the 18F4550 when MCLRE (Master clear reset) is enabled. This pin must be set high for the 18F4550 to operate. Since I didnít want to include any unnecessary components (the reset button), I turned this feature off which eliminates the need to keep this pin high.
2. Comment out USB_SELF_POWER_SENSE_IO & USE_USB_BUS_SENSE_IO in the "usbcfg.h" file Ė The demo board is set up to sense if the 18F4550should use the USB power supply vs. an external supply, and the sensing is done through certain pins. Since this is a minimalist approach, Iím getting rid of this functionality.
3. Now build the project and program the PIC18F4550.
4. Plug it into the USB port, and it will show up in Control Panel.System.Hardware.Device Manager.Human Interface Devices.
5. Assign the driver disributed by Microchip to the device.
Make sure you check out my projects:
USB Serial Communication using the Microchip MCP2200 - Interfacing microcontrollers with a computer using this cheap chip.
Interfacing a PCM1725 to a PIC16F690 - Adding audio to a project by interfacing a PCM1725 DAC to a PIC16F690.
Using the Avago ADNS-2610 Sensor - Programming an optical sensor from an optical mouse.
USB Communications using the PIC18F4550 - Programming a microcontroller to communicate with a computer via the USB port
Interfacing to Microcontrollers to SD Cards - Accessing files stored on SD Cards in FAT16 format via the SPI module in a microcontroller
Building Electronic Drums - How to construct electronic drums using piezo sensors
Circuit Archive - If you are looking for other sample circuits for various uses and components, this is the place for you.
Component List - If you are looking for suppliers for different project components, I've compiled some good ones here.
Any questions or comments - contact me at firstname.lastname@example.org