Wednesday, April 30, 2008

F-keys as control characters

It's somewhat easily found online that control characters map onto a keyboard easily. Take the numeric value of the control character, add 64, and you get a letter. Press Ctrl and this letter, and you get the control character.

However, one thing I couldn't fine anywhere online was how the F-keys mapped to ASCII. I needed a way to send them over a serial connection, and couldn't find a way.

Turns out that F1 is sent in three bytes; in decimal they are 27, 79, 80. For the other F-keys, the last byte is incremented, up to F4 (27, 79, 83). HyperTerm doesn't seem to send anything if you press F5 and beyond.

No comments: