Skip to main content

What is a Scan Code?


What is a Scan Code?

In the keyboard are little switches. When you press a key one of the switches is activated and when you release that key the switch is activated again. The keyboard makes note of these happenings and stores them in a small buffer (memory area) in the keyboard while it notifies the computer that something has happened at the keyboard (an interrupt). The computer, once notified of keyboard activity reads the buffer and takes the necessary action.
Each key on the keyboard has its own code that it sends when pressed and when released; this is called its scan code. When listing scan codes here we'll list the "press" scan code. The "release" scan code is that number plus 128 (80 hex).
While the original scan code specification allowed for a single number, newer keyboards with the movement keys repeated in the center of the keyboard forced a change and those keys carry a two-number scan code with the first number always being hex E0 (so programs reading scan codes first test for the E0 character; if not found process the code directly, if found, process the next code as one of the center movement keys).
At first blush the release code may seem redundant but when you think about how often you might press and hold the shift, control, or alt keys down while typing something else it becomes clear why it's needed.
That said, here are the various scan codes originally defined by IBM (you can see from the layout these were defined for the very first keyboard)...
  • hex 01 = Escape key
  • hex 02 = 1 or ! key
  • hex 03 = 2 or @ key
  • hex 04 = 3 or # key
  • hex 05 = 4 or $ key
  • hex 06 = 5 or % key
  • hex 07 = 6 or ^ key
  • hex 08 = 7 or & key
  • hex 09 = 8 or * key
  • hex 0A = 9 or ( key
  • hex 0B = 0 or ) key
  • hex 0C = - or _ key
  • hex 0D = = or + key
  • hex 0E = Backspace key
  • hex 0F = Tab key
  • hex 10 = q or Q key
  • hex 11 = w or W key
  • hex 12 = e or E key
  • hex 13 = r or R key
  • hex 14 = t or T key
  • hex 15 = y or Y key
  • hex 16 = u or U key
  • hex 17 = i or I key
  • hex 18 = o or O key
  • hex 19 = p or P key
  • hex 1A = [ or { key
  • hex 1B = ] or } key
  • hex 1C = Enter key
  • hex 1D = Control key (Left if two)
  • hex 1E = a or A key
  • hex 1F = s or S key
  • hex 20 = d or D key
  • hex 21 = f or F key
  • hex 22 = g or G key
  • hex 23 = h or H key
  • hex 24 = j or J key
  • hex 25 = k or K key
  • hex 26 = l or L key
  • hex 27 = ; or : key
  • hex 28 = ' or " key
  • hex 29 = ` or ~ key
  • hex 2A = Left shift key
  • hex 2B = \ or | key
  • hex 2C = z or Z key
  • hex 2D = x or X key
  • hex 2E = c or C key
  • hex 2F = v or V key
  • hex 30 = b or B key
  • hex 31 = n or N key
  • hex 32 = m or M key
  • hex 33 = , or < key
  • hex 34 = . or > key
  • hex 35 = / or ? key
  • hex 36 = Right shift key
  • hex 37 = * or PrtScr key
  • hex 38 = Alt key (Left one if two)
  • hex 39 = Space bar
  • hex 3A = Caps Lock key
  • hex 3B = F1 key
  • hex 3C = F2 key
  • hex 3D = F3 key
  • hex 3E = F4 key
  • hex 3F = F5 key
  • hex 40 = F6 key
  • hex 41 = F7 key
  • hex 42 = F8 key
  • hex 43 = F9 key
  • hex 44 = F10 key
  • hex 45 = Num Lock key on numeric keypad
  • hex 46 = Scroll Lock key on numeric keypad
  • hex 47 = 7 or Home key on numeric keypad
  • hex 48 = 8 or Cursor Up key on numeric keypad
  • hex 49 = 9 or Pg Up key on numeric keypad
  • hex 4A = - key on numeric keypad
  • hex 4B = 4 or Cursor Left key on numeric keypad
  • hex 4C = 5 key on numeric keypad
  • hex 4D = 6 or Cursor Right key on numeric keypad
  • hex 4E = + key on numeric keypad
  • hex 4F = 1 or End key on numeric keypad
  • hex 50 = 2 or Cursor Down kay on numeric keypad
  • hex 51 = 3 or Pg Dn key on numeric keypad
  • hex 52 = 0 or Insert key on numeric keypad
  • hex 53 = . or Delete key on numeric keypad
  • hex 54 = Sys Req key (on 84-key keyboard)
  • hex 57 = F11
  • hex 58 = F12
  • hex E1 = Pause key (on 101-key keyboard)
The following scan codes are preceeded by hex E0...
  • hex 1C = Enter key on numeric keypad
  • hex 1D = Control (Right if two)
  • hex 35 = / key on numeric keypad
  • hex 38 = Alt (Right if two)
  • hex 47 = Home
  • hex 48 = Up arrow
  • hex 49 = Pg Up
  • hex 4B = Left arrow
  • hex 4D = Right arrow
  • hex 4F = End
  • hex 50 = Down arrow
  • hex 51 = Pg Dn
  • hex 52 = Insert
  • hex 53 = Delete
While these are generally assigned scan codes, be aware that keyboards come in a wide variety of shapes and sizes and the scan codes from those may differ somewhat from the above.

Comments

Popular posts from this blog

Cain Problems!! "Unable to open Winpcap driver: The system cannot find the device specified."

Facing problem with Winpcap ? I used to use Cain long time ago on my Windows 7 PC.  It was working fine but yesterday I installed the cain again on same windows and found some errors in cain. When tried to start ARP and Sniffer a message came up " Unable to open Winpcap driver : The system  cannot  find the device specified." I thought may be I haven't restart my PC thats why this messsage is coming because during installation it said that Winpcap will work properly after reboot. So I rebooted my PC and again the same problem. This time I took a closer look into the message and i found the solution from the message itself. message clearly said that Unnable to open the driver. Here are the simple steps you can follow to fix this problem. Step 1: Goto configuration  Step 2: Select sniffer Step 3: Select the right driver.  (Usually its the driver which is showing the IP of the network which you wanna sniff.) Thats it. No need to restart again...

Remove videos from Recommended , Trouble with YouTube Home page.

Almost everyone of us is dealing with this problem . When we open our YouTube home page we see some unwanted thumbnails of videos . Which we might have clicked accidentally before or we had seen them but don't want them on our home page. What happens is when we click on any video YouTube put the related videos in your home page as recommended . So what is the solution for this problem. There are many solutions to this problem but I am going to tell you two simple solution to avoid these things. The first one is related to the channels . When you click on any video the video from that channel start showing on your page  so for that all you have to do is to click the three dots just next to the subscribe button and then click HIDE THESE VIDEOS and you are done . Now the second . It is to remove videos from your recommended videos. This is quite simple the recommended videos are shown on the basis of your viewing history . And to remove videos fr...

Your WhatsApp's First DP