0

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.

2
Contributors
1
Reply
3
Views
8 Years
Discussion Span
Last Post by DenisOxon
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.