Keyboard Communication Help

Reply

Join Date: Sep 2007
Posts: 36
Reputation: Webbsta is an unknown quantity at this point 
Solved Threads: 1
Webbsta Webbsta is offline Offline
Light Poster

Keyboard Communication Help

 
0
  #1
Dec 16th, 2008
First of all, if you have not done any hardware interfacing then you probably won't know the answer to this question, just to save you time of reading this post and then realising you don't know.

I'm having some trouble figuring out how to structure commands properly when communicating via the keyboard, and in this instance, turning on the capitals lock.

The following code is in C but should be easy to figure out from whatever language you prefer:
Note: out/inportb() is the same as out/inb()
apart from the first argument is the port, and
the second is the value.
	outportb(0x60, 0xED); // Send the KB command
	if (inportb(0x60) == 'ú') // Check the KB sent ACK
	{
		outportb(0x60, 0x2); // Send the Caps lock ID (2)
		if (inportb(0x60) == 'ú') // Check the KB sent ACK
		{
			outportb(0x60, 0x1); // Write the option bit: 1 (on)
		}
	}

What i have got is not correct, as no matter what values i write to the port, it never turns the capitals L.E.D on, so far i can get the number lock and scroll lock to go on, but not the capitals lock.

I would very much appriciate help on this, thanks.

EDIT: Sorry i wasn't sure which forum to put this in, but i thought that because this is not really based on the C language, it should be in the hardware section.
Last edited by Webbsta; Dec 16th, 2008 at 9:16 pm.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 319
Reputation: DenisOxon is an unknown quantity at this point 
Solved Threads: 15
DenisOxon's Avatar
DenisOxon DenisOxon is offline Offline
Posting Whiz

Re: Keyboard Communication Help

 
0
  #2
Dec 20th, 2008
Hi,

What are you trying achieve by turning capital lock on after receiving a character ? If you are trying to get upper case letters into your program, then if you switch it on after what will you do with that character ?

Why not instead just convert the character to upper case if it is lower case ?

Or am I missing something ?

Denis
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the USB Devices and other Peripherals Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC