| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| RAMAROSAONA 
 
 
 Joined: 02 Jul 2010
 Posts: 1
 
 
 
			    
 
 | 
			
				| USB Keyboard |  
				|  Posted: Fri Jul 02, 2010 11:09 am |   |  
				| 
 |  
				| I want to use a standard USB keyboard (PIH) on a 18F4550 project with LCD. Is it possible to use the 18F4550 as a USB Host? How can I get the keycodes of the keyboard?
 |  | 
	
		|  | 
	
		| Ttelmah 
 
 
 Joined: 11 Mar 2010
 Posts: 19967
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Fri Jul 02, 2010 2:47 pm |   |  
				| 
 |  
				| No. For a USB host, you need a PIC supporting USB 'OTG', or an external device like the Vinculum.
 
 However....
 Every USB keyboard I have seen so far, also works as a PS/2 keyboard. Basically, the USB/PS/2 adapters sold for these, _do not_ contain any adapter electronics. Instead they just alter the wiring directly from the keyboard to the PS/2 port, and the keyboard detects that it is connected to this, rather than to USB, and changes mode automatically.
 The wiring is normally:
 
  	  | Code: |  	  | USB      PS/2
 1           4
 2           1
 3           5
 4           3
 
 | 
 You also may need to have about 4K7R pull up resistors on pins 1, and 5 of the PS/2 connector.
 
 PS/2 'host' code, is as common as anything for the PIC.
 
 Best Wishes
 |  | 
	
		|  | 
	
		| newguy 
 
 
 Joined: 24 Jun 2004
 Posts: 1924
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Fri Jul 02, 2010 5:09 pm |   |  
				| 
 |  
				| Ttelmah, 
 Completely unrelated and off topic, but do you know if a USB mouse will also auto-switch to PS/2 mode as well?  We're kicking around an idea at work and this will greatly simplify things if true.
 |  | 
	
		|  | 
	
		| jbmiller 
 
 
 Joined: 07 Oct 2006
 Posts: 73
 Location: Greensville,Ontario
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat Jul 03, 2010 4:56 am |   |  
				| 
 |  
				| Mice are the same (at least the ones I have) although I have to use them in PS-2 mode for interrupt mode. |  | 
	
		|  | 
	
		|  |