PDA

View Full Version : usb keypad



theFob
- 10th December 2011, 17:47
Hi,</SPAN>
I am very new to your forum and I wish to greet all of you.</SPAN>
I am hardware engineer and so I need a little help, when I am stick with software.</SPAN>
I have to made strange looking “usb” keyboard with big buttons, that will interact with “On Key what ever” event on regular PC. I will switch IP Cameras. </SPAN>
So in tree beers time I draw some hardware (attached below). I call this “kitchen made” prototype, because I will make him there. Well, I can buy numeric pad and put her in my grande buttons box (GBB) but this will not make me happy. It will be nice to choose char code for keys or even a string.</SPAN>
So I need help. After 2 hours googleing I have no answer on this – how to tell to PC, that this is standard keyboard?</SPAN>

I extend my board with LCD, RS232 and ICSP capability just in case. If someone find my board useful and if this someone lives in Europe, I can send him a board.</SPAN>

pedja089
- 16th December 2011, 13:08
http://www.picbasic.co.uk/forum/showthread.php?t=14320&p=99516#post99516

theFob
- 17th December 2011, 20:26
Thanks</SPAN>
I started the thread, so I feel duty to finish. Down is the hardware ready to go.</SPAN>
There is a little error in the circuit. The diode D1 is in wrong direction.</SPAN>
6174

theFob
- 19th December 2011, 10:21
There is some code. The keyboard is ok, but the usb out freezes the pic.</SPAN>
Also windows don’t recognize the board as keyboard. I try to use </SPAN>
#define use_usb_bus_sense_io </SPAN>
from kbddesc1.asm, but I got undefined variable error in USB18 here:</SPAN>

957: # ifdef use_usb_bus_sense_io</SPAN>
958 btfss usb_bus_sense</SPAN>
959 bra somewhere</SPAN>

What to do?</SPAN>

theFob
- 19th December 2011, 15:03
Well, there is missing USBInit in the code.</SPAN>
This is happen when my beer is over.
Now Windows say: "There is unknown usb device"</SPAN>
What must to be changed in the descriptor?</SPAN>

Demon
- 19th December 2011, 18:04
I cheat when it comes to simple keypad applications. I just take the PCB from an old USB keyboard and hack the 2 connectors . The ones I have used so far use 2 connectors, then I map the connectors into a table.

The nice thing is that the USB communication is already complete and Windows recognizes yor device without problem. You can connect more than 1 identical keyboards in Windows XP.

There are several examples on google to hack a USB keyboard.

theFob
- 20th December 2011, 17:10
Thanks Daemon
The task I'm doing is litlle more complicated.
I need to send serial commands to other devices (HDMI Switch, etc.) and Keyboard events simultaneously from
this board. I also image a situation to receive commands from something.
If I use standart keypad I must to design serial-to-command-to-matrix decoder and vs.
By the way the board is still not recognized by Windows as HID. I check report descriptor twice,
the device descriptor seems ok but pic freezing by usbout.
May be some configs are wrong? I dont have any.

Demon
- 20th December 2011, 17:20
I'm stuck to using my cell phone so I can't do serious debugging.

Do you issue that USB SERVICE command or whatever it is called to keep your connection alive?

Sorry, wished I could be of more help.

Robert

theFob
- 22nd December 2011, 16:34
OK its done. The problem was in the serial bootloader.
And for ICSP the reset cap C3 must be far below 100nF - 10nF or lower.
I will post code soon as is ready. Then will make fun with the serial bootloader. I love UARTs!
Thank you Demon, you break myself talking hardly.
Cheers to all of you.
FOB

theFob
- 23rd December 2011, 19:55
ANDDDDDDDDDDDD: The Grande Button Box (GBB)
But I still have questions.
1. Can I simple relocate code and interrupts with some ORG
when I use serial bootloader?
2. Is there some negotiation between PC and usb HID(KBD) like these
with PC/2 keyboard - <MAKE>
code?
When I plug the box everything seems ok except that: the first pressed key is doing</SPAN>
strange things – repetition of chars, TAB, Window switching or nothing. And this relays to elapsed time from plug to press?!.</SPAN>
3. Is there “USB READY” call back or just a bit for such purpose?</SPAN>

theFob
- 26th December 2011, 14:32
I have little fight with snp.exe ( XP Antispyware 2012) worm in may PC, but I am the winner.
So this is the code for now. In my app I will remove the LCD and will add a lot of serial communication. This will be kind of consumer but friend of mine app.
My pbp version is 2.47. All is compiled with mpasm. I put all files from the directory in zip.
You must have a dir called pbp and pbpusb18.lib and pbppic18.lib files there.
You must quote configs in 18F2550.inc file.
Thanks for all descriptors and sample code and sorry for my Win(dot)English = almost.
This forum really helps me.
Very Christmas
Boyan Petrov as Fob
Sofia
Bulgaria