PIC 18F2550 usb hid keyboard example - Page 1
Forum section: electronics / general

author: Dajgoro
author_rank: Frequent Contributor
timestamp: April 02, 2015, 02:32:21 pm
content: Hi.I have a 18F2550 pic dev board, and I want to make a small project, where I attach one of those 1980' keyboard modules to it, so that it shows as a USB keyboard.Years ago I got that devboard working as a mouse with mplab and some example code, and that worked just fine. Now I went looking for any demo that i could use with MPLABX and I can't find anything at all!The demo i had before seems that uses hi-tech C, which is dead.Is there any hope of getting the 18f2550 usb hid working with XC8 and mplabx?

author: JTR
author_rank: Regular Contributor
timestamp: April 02, 2015, 03:29:28 pm
content: Download the MLA from the microchip web site. There is a hid keyboard example for this pic, compiler there in.

author: Dajgoro
author_rank: Frequent Contributor
timestamp: April 02, 2015, 06:21:02 pm
content: Quote from: JTR on April 02, 2015, 03:29:28 pmDownloaded, installed, tried the usb hid keyboard demo, but I have no idea how to get it working for the 18f2550. If i change the target ic, all of the register setting become invalid, so it is useless.

author: matkar
author_rank: Regular Contributor
timestamp: April 02, 2015, 10:14:52 pm
content: I use MPlab 8.76 with C18 compiler. I have Microchip Solutions v2012-04-03 library installed. If I open project:C:\Microchip Solutions v2012-04-03\USB\Device - HID - Keyboard\Firmware\USB Device - HID - Keyboard- C18 - PIC18F46J50 PIM.mcpand change the device to PIC18F4550 and linker script torm18f4550 - HID Bootload.lkr, it compiles without problems. I imagine there is not much to do to get it running on PIC18F2550. You will have to modifyHardwareProfile.handHardwareProfile - PIC18F46J50 PIM.hto match your hardware configuration but I guess there isn't much else to do. ReadMCHPFSUSB Library Helpfor additional info...

author: JTR
author_rank: Regular Contributor
timestamp: April 03, 2015, 10:36:45 am
content: The project you want is the fsusb version. This is for a 4550 and actually needs little or no changes for the 2550. Sorry I cannot help further as I am typing on a crappy tablet. Goto the microchip forum and search and ask there. It has been well covered there...

author: Dajgoro
author_rank: Frequent Contributor
timestamp: April 03, 2015, 02:16:16 pm
content: Quote from: JTR on April 03, 2015, 10:36:45 amI can't find fsusb demo for keyboard anywhere.

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 03, 2015, 02:34:09 pm
content: Quote from: Dajgoro on April 03, 2015, 02:16:16 pmSee attachment

author: Dajgoro
author_rank: Frequent Contributor
timestamp: April 04, 2015, 02:32:40 am
content: Quote from: PA0PBZ on April 03, 2015, 02:34:09 pmIt says:Cannot find include file "./USB/usb.h"and:Cannot find include file "./USB/usb_function_hid.h"And I have no idea why, since the header files are show as present in the project explorer.

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 04, 2015, 08:25:18 am
content: My bad, here are the \include\USB files.

author: Dajgoro
author_rank: Frequent Contributor
timestamp: April 04, 2015, 02:54:06 pm
content: Quote from: PA0PBZ on April 04, 2015, 08:25:18 amNow I get:make: *** No rule to make target '../../../../Microchip/USB/usb_device.c', needed by 'build/PICDEM_FSUSB/production/_ext/926206843/usb_device.o'. Stop.make: *** [.build-conf] Error 2

author: Dajgoro
author_rank: Frequent Contributor
timestamp: April 05, 2015, 04:09:35 pm
content: Also, there is no Compiler.h anywhere to be found.I use mplabx rarely, and i really don't understand how this all works, there are always lots of odd includes when dealing with usb stuff, and i have no idea why is it implemented like that.

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 05, 2015, 05:15:24 pm
content: I use it rarely too, so these error messages don't tell me a lot.I found the Compiler.h in Microchip\Include but instead of sending you another incomplete section have a look for yourself:http://www.microchip.com/pagehandler/en-us/devtools/mla/archives.htmlThe files I sent are from the v2011-12-05 version.