Are there keys that don't return ASCII codes?

  • Thread starter Thread starter JJBladester
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around identifying keys on a keyboard that do not return ASCII codes, exploring the nature of control characters and their representation in computing. Participants examine the distinction between keys that modify input and those that produce characters, as well as the implications of scan codes versus ASCII codes.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants suggest that control characters, such as the escape key, do not produce printable characters but still return an ASCII code (1B in hex).
  • Others propose that keys like CTRL, ALT, and Shift modify input without generating characters, raising questions about their ASCII code representation.
  • A participant clarifies that while the escape key does not display a character, it is still associated with a hex code and can be read by certain interrupts, implying it does return an ASCII code.
  • There is a distinction made between key codes (which indicate which key is pressed) and ASCII codes (which represent character values), with examples provided about how different keyboard layouts affect the output.

Areas of Agreement / Disagreement

Participants express differing views on whether certain keys return ASCII codes, particularly regarding the escape key and the nature of control characters. The discussion remains unresolved, with multiple competing perspectives on the definitions and implications of key codes versus ASCII codes.

Contextual Notes

Participants note the importance of distinguishing between key codes and ASCII codes, but the discussion does not resolve the implications of this distinction fully. There are also references to specific keyboard behaviors that may vary across different operating systems and layouts.

JJBladester
Gold Member
Messages
281
Reaction score
2

Homework Statement



Give an example of a key that does not return an ASCII code.

The Attempt at a Solution



I looked at the extended ASCII table on www.ascii-code.com and found that there are several "control characters" which do not return a printable character. It seems pretty obvious that the escape key does not print a character, for example. However, it still returns code 1B (hex). I cannot imagine why there would be a key that would not return an ASCII code, and if so which key(s) that/they would be.
 
Physics news on Phys.org
JJBladester said:

Homework Statement



Give an example of a key that does not return an ASCII code.

The Attempt at a Solution



I looked at the extended ASCII table on www.ascii-code.com and found that there are several "control characters" which do not return a printable character. It seems pretty obvious that the escape key does not print a character, for example. However, it still returns code 1B (hex). I cannot imagine why there would be a key that would not return an ASCII code, and if so which key(s) that/they would be.

Think about the keys on your keyboard that modify the input or do something but don't actually produce characters on their own.
 
trollcast said:
Think about the keys on your keyboard that modify the input or do something but don't actually produce characters on their own.

I see where you are going with this (CTRL, ALT, Shift, etc.).

However, the escape key doesn't produce characters on the screen although it still has a hex code associated with it and it still can be read by certain interrupts like INT 16H. So, I am inclined to say it *does* return an ASCII code even though it is not displayed on the screen.
 
JJBladester said:
I see where you are going with this (CTRL, ALT, Shift, etc.).

However, the escape key doesn't produce characters on the screen although it still has a hex code associated with it and it still can be read by certain interrupts like INT 16H. So, I am inclined to say it *does* return an ASCII code even though it is not displayed on the screen.

The key / scan code is different to the ASCII code.

The key code tells the computer which key has been pressed, the os converts these into either values such as ascii codes or it will do something, eg. pressing the windows key will open the start menu, cap lock toggles the value the alphabet keys take, etc.

(The scan / key code tells which one of the keys on the keyboard has been pressed but not what it actually means so number 17 which is q on an english QWERTY keyboard would return a on a french AZERTY keyboard)
 
Thanks for clarifying about the scan codes vs. ASCII codes.
 

Similar threads

Replies
11
Views
6K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 13 ·
Replies
13
Views
5K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
8
Views
3K
Replies
1
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 16 ·
Replies
16
Views
15K
  • · Replies 1 ·
Replies
1
Views
2K