Page 1 of 1

Keyboard USB

Posted: Tue Mar 20, 2012 6:40 pm
by electron67
Hi, I want connect a keyboard USB to PIC18F2550 without use the PC; when press a letter or number show in the LCD the key pressed and led on in binary, but is a little confused. I send the program. I can use e-block eb-055 to connect the keyboard, but + V out USB connect to +5v :?:

Thank you

Re: KEYBOARD USB

Posted: Tue Mar 20, 2012 7:10 pm
by kersing
For what you want you need for USB host or USB on-the-go functionality and PIC 18 series only offer slave functionality.

Are you sure the keyboard can be connected to the eb055? The USB keyboards I know use USB type A plugs. The eb055 provides an USB type B port.

Re: KEYBOARD USB

Posted: Tue Mar 20, 2012 7:33 pm
by electron67
I want a switch multiple; identify the key presed calling "x" convert of binary to decimal and switching a relay; without use PC.
I use conector USB B to A

Re: KEYBOARD USB

Posted: Wed Mar 21, 2012 12:11 am
by kersing
Sorry to disappoint you, but what you want can not be done with a PIC18F2550.

Starting at the beginning, there are three types of USB devices:
1) USB Host, examples: computer, media player. These devices have a USB type A socket.
2) USB Slave, examples: keyboards, mouse, USB flash drive, USB disk drive. These devices have a USB type A plug, USB type B socket or mini/micro USB connector.
3) USB On-The-Go, examples: some mobile phones. For more information see this explanation

For USB to work you have to connect a USB Slave to a USB Host.

The Flowcode for PIC USB components (including the HID component you are using) are for slave devices. The keyboard is a slave device. So you are trying to have a slave device talk to a slave device, that will not work without a master like a computer in between.

Re: Keyboard USB

Posted: Wed Mar 21, 2012 11:23 am
by Benj
Hello,

Kersing is correct a 18F2550 cannot host a USB device.

Would a PS/2 Keyboard be an option? These can work with pretty much any microcontroller.

Re: Keyboard USB

Posted: Wed Mar 21, 2012 6:52 pm
by electron67
Ok; I can read in the PC the letter o number pressed in the keyboard, write in the "x" variable, compare with "y" data, and send a "1" logic to pin out of microcontroler ?
You have to ejemple or where I can learn to do this ? :?:
Also I can use a keyboard PS/2 whitout PC You have a ejemple; Ben say is possible..

Thank you

Re: Keyboard USB

Posted: Thu Mar 22, 2012 1:35 pm
by Benj
Hello,

Here is a very old Flowcode example for a PS2 device.

Let me know how you get on.