Quick Key Adapter, 10 Button HID Keyboard. Part 2 - Firmware
This device's design is based on the Low Pin Count Development Kit hardware from Microchip, Microchip Solutions has example programs for that development kit so it is quite easy to get them running on the device covered in this Instructable.
For the purposes of this project I used the USB Device - HID - Keyboard example for the Low Pin Count Development Kit. But there are various other devices that could be programmed onto this hardware/device, anything that could use 10 switch inputs.
Included in the ZIP on Step 1 is the MPLAB project files, you must install the latest version of MPLAB and the latest release of C18 compiler. Microchip Downloads Can Be Found Here
The included project files were taken and modified from Microchip's example code. They had wrote it in a way so it can run on multiple different PIC devices, so there is a lot of extra code not needed. The rest is mostly USB related code, the only function that was modified was the Keyboard() function.
ProcessIO() -> Keyboard() -> Check if IN endpoint is ready -> Check Switches ->Send Data -> ProcessIO()
The switches state are checked and compared to their previous state. if the states differ the switch is considered pressed and will fill a data buffer with/the required data then send it. Then continue checking the switches.
hid_report_in = is the modifier byte, it holds the state of the shift, alt, ctrl, gui(windows) keys
Modifier key chart:
Such as Minimize Window which the Windows hotkey is Alt+Spacebar, then press n.
If you have a blank PIC18F14K50 or want to be able to flash the firmware, there are 2 options.
Check everything over well, a short could damage the Host Computers USB bus. All solder joints should be shiny.
News on theme: