943,552 Members | Top Members by Rank

Ad:
Dec 16th, 2008
0

Keyboard Communication Help

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
Webbsta is offline Offline
36 posts
since Sep 2007
Dec 20th, 2008
0

Re: Keyboard Communication Help

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
Reputation Points: 22
Solved Threads: 19
Posting Whiz
DenisOxon is offline Offline
345 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in USB Devices and other Peripherals Forum Timeline: Video Camera - Fixing Geometry Issue
Next Thread in USB Devices and other Peripherals Forum Timeline: Cursor Problems with HP xb3000 docking station





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC