|Keyboard Scan Codes|
|Home Barcode Mill Barcode Fonts How to order Email us|
You can now determine specific Keyboard Scancodes and sequences without the need to look them up individually in a table and assemble them by hand. Just click on the keys and cut and paste the results. The Keyboard Emulator is here
It’s easy to get confused over scancodes because the AT scancodes used at the hardware level are converted by the PC Bios into XT codes. If you are an engineer looking at the keyboard bus lines with a ’scope or 'Reverse Mule' analysis unit you will likely see AT style scancodes. But if you are a programmer you will probably be dealing with XT codes. This is to maintain backward compatibility with the earliest PCs of the mid 1980s. If anyone knows of any equipment still using XT codes at the hardware level please let me know.
Since this page was first written six new keys have been added to the original keyboards. The scancodes for these keys can be found at the foot of this page. The Mule can emulate ALL the new keys.
All the scancodes published here have been verified with The Shadow Mule and are known to be accurate. Data published elsewhere is often seen to contain errors. Please do not copy this data into another medium or web site. It is maintained up to date here and we strictly enforce our copyrights. We are happy for any site to link here.
The PC keyboard interface is designed so the system software has maximum flexibility in defining certain keyboard operations. This is accomplished by having the keyboard return scancodes rather than ASCII codes. Each key generates a 'make' scancode when pressed and a 'break' scancode when released. The computer system interprets the scancodes to determine what operation it is to perform. For historical compatibility reasons computers can employ different sets of scancodes for different purposes. Earlier PC computers tend to use the XT scancode set. Current PC computers tend to use the AT scancode set. The MF1, MF2 and MF3 sets are alternatives, similar in many respects to the XT and AT sets. The table below shows the scancodes generated when a key is pressed- the 'make' code. The 'break' code may be derived from the 'make' code as described later. Notice that scancodes may consist of a single or several bytes.
Many keyboard scancode tables published are not completely accurate. Confusion arises between scancodes issued by the keyboard hardware and the scancodes appearing in the keyboard buffer. The scancodes presented here are those actually sent by the keyboard hardware. The computer BIOS may translate the code for compatibility reasons. For example, the XT scancode set was first used in the original IBM PC computer. Other IBM computers and terminals used a different scancode set. Apparently IBM tried to bring the PC into line with its other products when the IBM PC/AT was launched. The keyboard for that machine used a scancode set virtually identical to other IBM machines. However to maintain compatibility with earlier PC software the BIOS for the AT machines converted the AT scancodes into the earlier XT scancodes. At the current time (June 1995) this system of code conversion in the BIOS persists. The code you read from the keyboard buffer is not necessarily the same code transmitted from the keyboard.
The 'break' code for XT style computers is the 'Make' code OR’d with the hexadecimal value 80. (If you are unfamiliar with hexadecimal numbers then simply change the first character of the scancode thus: Change 0 to 8, 1 to 9, 2 to A, 3 to B, 4 to C, 5 to D, 6 to E, 7 to F)
For example the scancodes generated by pressing and releasing the Escape key (Key Number 110) are 01 81
Most PC’s made since about 1989 use keyboards that generate AT scancodes (Though the codes may be converted to XT scancodes in the BIOS). The 'break' code for AT class scancodes is simply the 'make' code preceded by hex F0. For example the scancodes generated when the Escape key is pressed and released are 76 F0 76.
If the keyboard’s buffer overflows it sends a special scancode to the computer. This generally causes the computer to sound a warning beep. Altek Mule(tm) users may issue this code if they want to sound the beep to draw the operators attention. For computers using AT scancodes the code is 00. (For obsolete PCs using XT scancodes the code was hex FF)
When the 'Windows 95' operating system was introduced three new keys were added to the PC keyboard. These keys have been retained for all subsequent operating systems and PCs. They are the two 'Flying Windows' keys and the 'Pop Up Menu' key. These keys may be emulated by The Mule in Scancode Mode just like any other key. The appropriate 'make' and 'break' scancodes are shown below...
Left Flying Window
|E0 F0 1F|
Right Flying Window
|E0 F0 27|
Pop Up Menu
|E0 F0 2F|
Some computers are appearing with 3 extra Power Management keys. These keys are used to support OnNow architecture PCs. (OnNow is a term for a PC that is always on but appears off and responds immediately to user or other requests.) The three keys are Power, Sleep and Wakeup. These keys are non repeating keys. In other words the 'Make' scancode is sent once regardless of how long the key is held down. These keys may be emulated by The Mule in Scancode Mode just like any other key. The appropriate 'make' and 'break' scancodes are listed below...
|E0 F0 37|
|E0 F0 3F|
|E0 F0 5E|
Altek Instruments have designed and built a general purpose, low cost PC interface which generates Keyboard Scancodes. Any key or combination of keys may be emulated thus enabling any applications program to interact with RS232 peripheral devices. We call it The Mule™.
Altek Instruments Ltd have a range of products designed for the data collection/automatic ID industries.
|Top Home||© Lee Allen, 2016|