Category: 

What Is a Scancode?

Article Details
  • Written By: Alex Newth
  • Edited By: A. Joseph
  • Last Modified Date: 25 August 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
The atmosphere of Jupiter's moon Io collapses every time it is eclipsed by the planet.   more...

September 29 ,  2008 :  The Dow Jones Industrial Average experienced its largest one-day drop in history.  more...

Very few people recognize how many calculations, codes and processes are used just to get a character from a computer keyboard onto the screen. One part of this function is the scancode, or a hexadecimal code that is the equivalent of the key pressed on the keyboard. There is a scancode for every key on the keyboard, and there is another separate scancode for when the key is released. Keyboards for different character structures, such as Asian languages, will have a different number of scancodes because the number of keys differs. When the button is pushed, the code is placed into a buffer area so the computer can process and then add the character or recognize the key.

The entire keyboard process can be separated into several different steps. When the key is pushed, the scancode enters the keyboard buffer. While in the buffer, an interrupt is utilized to tell the computer that something has been pushed on the keyboard. After understanding that a key was pushed, the computer looks at the buffer, checks the hexadecimal code, then adds the character or its attribute onto the screen.

Both text and control characters have scancodes. Text keys are the more commonly used ones — containing letters, numbers and symbols — but control characters are used often as well. Control characters are the ones that do not make any symbol but affect the document or character processing, such as the "shift" keys or "enter" key.

Ad

Every key on the keyboard actually has two different scancodes, one for pressing and one for releasing. When a key is pushed, it gives one scancode, and the second code adds 128 to the hex value. This might seem useless, because it seems rare for someone to hold a key for several seconds, but this is done often with some control characters such as the "shift" keys or "delete" key.

The hexadecimal value for each key differs based on the keyboard. Each company has its own keyboard, and although the configuration might be similar to or even the same as other ones, the scancodes might be different. This usually is to allow the manufacturer to make keyboards with different key configurations or to add new functions to the keyboard, such as a "print" key.

Another factor in determining the hexadecimal value of each key is the language for which it is made. For example, Japanese and English keyboards have a different number of keys because the number of characters used differs. Different English-speaking countries, such as the United States and England, have different keyboards as well; most English keyboards have 102 keys, and most U.S. keyboards have 101.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}