Definitions for the Universal GKOS Wireless IR keyboard
- reload/refresh -
Keycode and its Character reference
(Draft 15)

0    (not used)
1    a
2    b
3    c
4    d
5    e
6    f
7    g
8    h
9    i
10    j
11    k
12    l
13    m
14    n
15    o
16    p
17    q
18    r
19    s
20    t
21    u
22    v
23    w
24    x
25    y
26    z
27    ü  (US mode: th)
28    å  (US mode: 'a ')
29    ä  (US mode: 'the ')
30    ö  (US mode: 'of ')
31    .
32    ,
33    !
34    ?
35    -
36    '
37    \
38    /
39    ¨ (US mode: 'and ')
40    ~
41    ^ (US mode: 'to ')
42    Arrow up
43    Arrow down
44    PgUp
45    PgDn
46    Backspace
47    Arrow left
48    Word left like (Ctrl + Arrow left)
49    Home
50    Space
51    Arrow right
52    Word right (like Ctrl + Arrow right)
53    End
54    Enter
55    Tab
56    Esc
57    Del
58    Ins
59    Shift ON (key down) (right)
60    Header for IR link
61    123-ABC
62    Ctrl ON (key down) (left)
63    Alt ON (key down)
64    1
65    2
66    3
67    4
68    5
69    6
70    0
71    7
72    8
73    9
74    #
75    ½ <>
76    &
77    @
78    +
79    %
80    =
81    yen sign <>
82    *
83    € <>
84    $
85    £ <>
86    (
87    [
88    <
89    {
90    )
91    ]
92    >
93    }
94    :
95    ;
96    inverted ! <>
97    inverted ? <>
98    _
99    "
100    ´ (acute accent)
101    ` (grave accent)
102    |
103    § <>
104    ¤ (currency sign) <>
105    inverted ^ (caron) <>
106    F1
107    F2
108    F3
109    F4
110    F5
111    F6
112    F7
113    F8
114    F9
115    F10
116    F11
117    F12
118    AltGr ON
119    CAPS ON (key down and up)
120    Num Lock ON (key down and up)
121    Windows Menu key DOWN
122    Windows Start key  DOWN (flywin)
123    Print Screen
124    Scroll Lock ON (key down and up)
125    Pause/Break
126    SYMB (ON)
127    reserved

  <> = not found on US QWERTY

128    4 bytes of Mouse Data follow
          (see bottom of this page)

Remote control functions (DRAFT):
- ref. character/function shown first
129    A  Volume +
130    B  Navi key left, MD/CD: Skip -
131    C  Volume -
132    D  Channel +
133    E  Navi key right, MD/CD: Skip +
134    F  Channel -
135    G
136    H
137    I
138    J
139    K   Enter numbers, MD: - - / >9
140    L
141    M  (Menu)
142    N  Enter numbers, MD: - - / >9
143   O
144   P  (Page)
145   Q
146   R   Record
147   S   Scroll display (Setup)
148   T   Text,  MD: Write Song Title
149   U
150   V
151   W   Wind forward
152   X
153   Y
154   Z
155   Ü    Rewind
156   Å
157   Ä
158   Ö
159   .
160    ,
161    !
162    ?
163    -
164    '
165   \
166   /
167   ¨  
168   ~
169   ^
170   Arrow Up   Navi key Up
171   Arrow Down   Navi key Down
172   Page Up  Eject
173   Page Down   Power on/off
174   Backspace   Stop
175   Arrow Left   Cursor left
176   Word Left   Skip -
177   Home
178   Space   Play (Select)
179   Arrow Right   Cursor right
180   Word Right   Skip +
181   End   End search
182   Enter   Enter, MD: Store Song Title
183   Tab, MD: Display mode
184   Esc   Exit Edit/Write mode
185   Delete   Delete
186   Insert

Special key codes:

187   Shift OFF (key up) Shift OFF
188   SHIFT Key (key pressed)
189   (123-ABC) 123 <=> ABC switch
190   Ctrl OFF (key up)
191   Alt OFF (key up)

Remote Control functions cont'd

192   1  1  Values 192 to 255 may also
193   2  2   be used to send GKOS kbd
194   3  3   status via COM port to the
195   4  4   driver software. If at least
196   5  5   127 consecutive values 192
197   6  6    are received in a row, this
198   0  0    mode will be turned on by the
199   7  7    driver.  (UART Chord Mode)
200   8  8
201   9  9
202   #  - - / >9
203   ½
204   &
205   @
206   +
207   %
208   =
209   yen
210   *
211   €
212   $
213   £
214   (
215   [
216   <
217   {
218   )
219   ]
220   >
221   }
222   :
223   ;
224   inv.!
225   inv.?
226   _
227   "
228   ´
229   `
230   |
231   §
232   ¤
233   inv.^


234  <reserved>
235  <reserved>
236  <reserved>
237  <reserved>
238  IR Device Address 6
239  IR Device Address 7
240  IR Device Address 0
241  IR Device Address 1
242  IR Device Address 2
243  IR Device Address 3
244  IR Device Address 4
245  IR Device Address 5

246   AltGr OFF (key up)
247   CAPS OFF (key down and up)
248   Num Lock OFF (key down and up)
249   Windows Menu key UP
250   Windows Start key  UP (flying win)
251   (spare)
252   Scroll Lock OFF (key down and up)
253  AKU (All Keys Up, UART KeyCode mode)
254   (SYMB OFF)
255  End of Mouse Data

Keycode in
binary and hex

0000 0000   00
0000 0001   01
0000 0010   02
0000 0011   03
0000 0100   04
0000 0101   05
0000 0110   06
0000 0111   07
0000 1000   08
0000 1001   09
0000 1010   0a
0000 1011   0b
0000 1100   0c
0000 1101   0d
0000 1110   0e
0000 1111   0f
0001 0000   10
0001 0001   11
0001 0010   12
0001 0011   13
0001 0100   14
0001 0101   15
0001 0110   16
0001 0111   17
0001 1000   18
0001 1001   19
0001 1010   1A
0001 1011   1B
0001 1100   1C
0001 1101   1D
0001 1110   1E
0001 1111   1F
0010 0000   20
0010 0001   21
0010 0010   ...
0010 0011
0010 0100
0010 0101
0010 0110
0010 0111
0010 1000
0010 1001
0010 1010
0010 1011
0010 1100
0010 1101
0010 1110
0010 1111
0011 0000
0011 0001
0011 0010
0011 0011
0011 0100
0011 0101
0011 0110
0011 0111
0011 1000
0011 1001
0011 1010
0011 1011
0011 1100
0011 1101
0011 1110
0011 1111
0100 0000
0100 0001
0100 0010
0100 0011
0100 0100
0100 0101
0100 0110
0100 0111
0100 1000
0100 1001
0100 1010
0100 1011
0100 1100
0100 1101
0100 1110
0100 1111
0101 0000
0101 0001
0101 0010
0101 0011
0101 0100
0101 0101
0101 0110
0101 0111
0101 1000
0101 1001
0101 1010
0101 1011
0101 1100
0101 1101
0101 1110
0101 1111
0110 0000
0110 0001
0110 0010
0110 0011
0110 0100
0110 0101
0110 0110
0110 0111
0110 1000
0110 1001
0110 1010
0110 1011
0110 1100
0110 1101
0110 1110
0110 1111
0111 0000
0111 0001
0111 0010
0111 0011
0111 0100
0111 0101
0111 0110
0111 0111
0111 1000
0111 1001
0111 1010
0111 1011
0111 1100
0111 1101
0111 1110
0111 1111



1000 0000




1000 0001
1000 0010
1000 0011
1000 0100
1000 0101
1000 0110
1000 0111
1000 1000
1000 1001
1000 1010
1000 1011
1000 1100
1000 1101
1000 1110
1000 1111
1001 0000
1001 0001
1001 0010
1001 0011
1001 0100
1001 0101
1001 0110
1001 0111
1001 1000
1001 1001
1001 1010
1001 1011
1001 1100
1001 1101
1001 1110
1001 1111
1010 0000
1010 0001
1010 0010
1010 0011
1010 0100
1010 0101
1010 0110
1010 0111
1010 1000
1010 1001
1010 1010
1010 1011
1010 1100
1010 1101
1010 1110
1010 1111
1011 0000
1011 0001
1011 0010
1011 0011
1011 0100
1011 0101
1011 0110
1011 0111
1011 1000
1011 1001
1011 1010



1011 1011
1011 1100
1011 1101
1011 1110
1011 1111



1100 0000
1100 0001
1100 0010
1100 0011
1100 0100
1100 0101
1100 0110
1100 0111
1100 1000
1100 1001
1100 1010
1100 1011
1100 1100
1100 1101
1100 1110
1100 1111
1101 0000
1101 0001
1101 0010
1101 0011
1101 0100
1101 0101
1101 0110
1101 0111
1101 1000
1101 1001
1101 1010
1101 1011
1101 1100
1101 1101
1101 1110
1101 1111
1110 0000
1110 0001
1110 0010
1110 0011
1110 0100
1110 0101
1110 0110
1110 0111
1110 1000
1110 1001


1110 1010
1110 1011
1110 1100
1110 1101
1110 1110
1110 1111
1111 0000
1111 0001
1111 0010
1111 0011
1111 0100
1111 0101

1111 0110
1111 0111
1111 1000
1111 1001
1111 1010
1111 1011
1111 1100
1111 1101
1111 1110
1111 1111
Definitions and Examples
(Draft 15UPDATED 24 Jan 2007 (Key Codes 192-255)

Note that this table is not describing the character set in order to find out how to type characters!  The table here can be used e.g. when designing a driver for the infrared receiving device.  - The character set for typing can be found here.


GKOS Keyboard Codes

The table on the left defines the keycodes that are transmitted from a GKOS keyboard by using a wireless infrared link or UART serial port. Infrared codes can be sent in different IR formats. These include IrDA physical layer frame structure for transmitted individual bytes, and SIRCS-type 11-bit GKOS-specific IR frames (key code packets).

The most robust and the recommended way for the IR link is that GKOS chord values (= status of the keyboard) are sent. In this case, the table here is not used by the IR sending keyboard. Just the keyboard status is sent repeatedly using GKOS IR chord value packets. This is also compatible with all previous PIC projects. The IR receiver will in that case determine the chords and send the Keycodes through the UART/COM port to the driver.

There are no separate codes for pressing and releasing a key for most characters. Only 'sticky keys' (e.g. Shift, Ctrl, Alt and AltGr) have both key-down and key-up codes.

This table can remain as it is also for all national layouts because national versions can preferrably be implemented at the device drivers at the receiving side. The symbols listed here map to the physical chords as defind for the FIN/SWE and US versions of the GKOS keyboard layout. To switch between US and FIN/SWE layout modes, type [Alt] [123-ABC] ('Alternative mode').


RS232 Connector (UART serial port)

At the RS232 connector, one byte per character is sent unless there are separate codes for key up and key down (two bytes then).

    Example 1a: key 'a' pressed and released:
    0000 0001    code for 'a' (1)

    Example 1b: SHIFT down > key 'a' > SHIFT up
    SHIFT pressed:
      0011 1011    Code for SHIFT (59), key down
    Key 'a' pressed and released:
      0000 0001    Code for 'a' (1)
    "SHIFT released" (not actually):
      1011 1011    Code for SHIFT (187), key up

or,  in case the driver keeps track of Shift status:

    SHIFT pressed and released:
      1011 1100    Code for SHIFT Key (188)
    Key 'a' pressed and released:
      0000 0001    Code for 'a' (1)

UART port configuration is 9600 bit/s, one start bit, 8 data bits with no parity, and one stop bit.

Each character code received through the RS232 connector by the device driver software is passed to the operating system as a corresponding keyboard entry.


Wireless IR Link

At the wireless IR link, it is necessary to distinguish between different IR devices.

The IrDA frames are only 8 bits of data each, so 3 bytes per character are normally sent: Header, Address and the character code. (Reception not yet implemented)

Example 2a: key 'a' pressed and released:
    0011 1100    Header (60)
    1111 0000    IR Device address (default = 0)
    0000 0001    Code for 'a' (1)

Example 2b: SHIFT down > key 'a' > SHIFT up
    SHIFT pressed:
      0011 1100    Header (60)
      1111 0000    IR Device address (default = 0)
      0011 1011    Code for SHIFT (59), key down
    Key 'a' pressed and released:
      0011 1100    Header (60)
      1111 0000    IR Device address (default = 0)
      0000 0001    Code for 'a' (1)
    SHIFT released:
      0011 1100    Header (60)
      1111 0000    IR Device address (default = 0)
      1011 1011    Code for SHIFT (187), key up

The IrDA frame consist of one start bit ('0'), 8 data bits and one stop bit ('1'). Bit rate 9600 bit/s is used. Each '0' is represented by an IR pulse with a duration of 3/16 of the bit period. For logical '1's, nothing is sent.

The receiving routine of the device driver should check first if a Header byte is received. If the answer is yes, the next byte is received and checked for a correct Device Address.  If correct, the character code is then received and passed to the operting system as a corresponding keyboard entry. If there is an error in the address, a new Header is needed next. If, instead of the address or keycode, a Header is received, a valid Device Address shall be received next.


The GKOS IR byte transmission of key code packets (SIRCS-type  IR data but only 11-bit frames) has 8 bits of data and 3 bits of address information, so only one frame per character (one byte, LSB first, plus IR address bits) needs to be sent:

Example 3a: key 'a' pressed and released:
    1000 0000 000    code for 'a' (1) and 3 address bits

Example 3b: SHIFT down > key 'a' > SHIFT up
    SHIFT pressed:
      1101 1100 000    Code for SHIFT (59), key down
                                     + 3 address bits
    Key 'a' pressed and released:
      1000 0000 000    Code for 'a' (1) + 3 address bits
                                     SHIFT released:
      1101 1101 000    Code for SHIFT (187), key up
                                     + 3 address bits

Transmission order is [start pulse] D0...D7 A0  A1  A2. This IR transmission method is not as robust to IR interference as the GKOS chord IR packets described above.


Notes

SYMB, 123-ABC, CAPS

Information about pressing SYMB and 123-ABC keys is sent but they should normally be ignored by the driver at the reception because they already have an impact on the Keycode to send.

CAPS (caps lock) status is indicated by the first bit of the Keycode (CAPS ON/OFF) to better synchronise the CAPS status at both ends. CAPS has no separate key down and key up codes.


Shortcuts

A string of codes corresponding to a series of key presses can be sent by entering certain shortcuts on the GKOS keyboard. For example, typing e- as a chordon (no release of common keys between characters) causes transmission of a series of Keycodes (at UART) to type the word each followed by a space.


Mouse Data

Keycode 128 is special. After it, four Keycodes will always be sent but their values must be enterpreted as mouse data (see bottom of this page).  This method of sending mouse data is used on the UART serial port (RS232) and can also be used on a fast secure link like Bluetooth. (Mouse data transfer using IrDA bytes may also be practical but if a fast real IrDA link with the protocols involved is used, then the Keycode 128 method can well be applied.) End of Mouse Data, Keycode 255, is sent after the 4 bytes of mouse data to ensure integrity. If the value of the 5th byte received (by the driver) is not 255, the mouse data is discarded and reception of Keycodes is started.  -    On the slower GKOS IR link, the shorter GKOS mouse data packets are used as specified earlier.


All Keys Up signals (253 and 192)

UART KeyCode Mode
Keycode 253 (AKU) is sent on UART once every time all keys are released indicating wheter characters were entered as a chordon (string of chords) or not. This makes it possible for the driver to detect  entering of Chordon Shortcuts in order to send the corresponding shortcut word. For example, if the driver receives [AKU] ? w [AKU] it will send "what ".

UART Chord Mode
Sending KeyCodes 192, in a row 127 times, at the start up (and each time all keys are released) indicates that all other bytes received on the UART are Chord values (1...63) and not final KeyCodes. Chord values just indicate the state of the 6 keys and they are sent at 10 ms intervals. Chord values 1 to 63 are sent via UART as the 6 LSBs of KeyCodes 193 to 255. Chord value 0 (all keys up) is sent as KeyCode 192, 128 times repeatedly unless any key is pressed.   -  This method assumes that the driver software takes care of most things, like the decisions on typed characters, shortcuts etc, and the interface device requirements are minimal. Any received value less than 192 will disable this mode. This will be the next feature included in the GKOS IR receiver and the PC driver software (GKOS on QWERTY), making it possible to make all the many new features of the driver (now for SDF/JKL keys) available on the IR link and PIC devices as well !


SHIFT Key / Shift ON / Shift OFF

To enable Chordon Shortcuts where the Shift key is one part of the entry (e.g. 'Shift i' typed as a chordon produces 'I ', capital i + a space), it is necessary to indicate the actual press of the Shift key. Drivers that provide shortcuts must keep track of the Shift status based only on reception of the 'SHIFT Key' signal (188, see the table). In this case, Shift ON/OFF signals have no use.

_______________________

ADDITIONAL FEATURES

- these are needed only to set up the keyboard


To Control AV Equipment

If the GKOS keyboard is not functioning as a remote control for AV equipment, for example this command can be used:

[SYMB] [Ctrl] m [ENTER]    ('Control MD')

It turns the GKOS keyboard into a MiniDisc remote control and Sony SIRCS infrared signals are transmitted. In addition, codes 1-245 are sent at RS232 output.


While operating as a remote control, the standard GKOS typing mode can be visited to enter text, numbers and symbols by pressing:

T  to enter GKOS typing mode (text/symbols/numbers) e.g. for entering MD song titles

To exit the GKOS typing mode, press [ESC] and you are back in remote control mode.


You can also just press [123-ABC] to enter numbers e.g. when selecting MD/CD tracks or TV program numbers. Press # (K) to enter numbers larger than 9. A second [123-ABC] will take back to remote commands.



Configuring the keyboard for different devices

The GKOS keyboard may include a table for each audio/video device for converting most codes on the table (left) to corresponding IR codes and formats. To configure the GKOS keyboard for a specific device, type:

[SYMB][Ctrl] xxx [ENTER]    ('Control xxx')

where xxx is the identity for the device (e.g. m, md or dvd) to be remote controlled. [SYMB] may not be needed while in remote control mode and just changing the AV device (e.g. MD mode to TV mode).


The GKOS keyboard of this project will implement:

[SYMB] [Ctrl] i [ENTER]
IrDA format, Keycodes 1-255 directly, no remote control codes,  to send IrDA formatted bytes to a PC or PDA,

[SYMB] [Ctrl] m [ENTER]
Sony SIRCS format for MD,  to operate a Sony MD player and enter text for song titles. Codes have been defined by Sony.

[SYMB] [Ctrl] t [ENTER] (not yet fully implemented)
An example of TV remote control. Codes for a rare TV brand (ASA) are sent.

[SYMB] [Ctrl] c [ENTER]
GKOS chord mode,  to send the pressed chord values 0-63 continuously for PS/2 GKOS IR interface.

[SYMB] [Ctrl] g [ENTER]
GKOS byte mode, Keycodes 1-255 directly, no remote control codes.  Send SIRCS-type 11-bit IR frames one per character. This mode can also be used at the reception if just the UART output is used (e.g. connected to the PC) because chord and chordon detection works best if IR bursts (for sending) are short as with byte mode (one IR packet per character).

[SYMB] [Ctrl] a [ENTER] (not yet implemented)
  AV mode, sending remote control codes is default,
  available for IrDA mode or GKOS byte mode

[SYMB] [Ctrl] u [ENTER] (not yet implemented, use GKOS byte mode in reception insted)
UART mode sending Keycodes 1-255 through the UART output (In addition, IrDA frames are sent at the IR output). Note that UART output (RS232) is used in all modes above in addition.


 After Keycode 128, four bytes of Mouse Data follow (UART serial port):

Byte 1 
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Y overflow
X overflow
Y sign bit
X sign bit
Always 1
Middle Btn
Right Btn
Left Btn
Byte 2
X Movement
Byte 3 
Y Movement
Byte 4
Z Movement
Values for Z Movement (Scroll wheel) are in the range of -8 to +7 and use up only the least significant four bits (Z3, Z2, Z1, Z0).
The upper four bits (Z7, Z6, Z5, Z4) are spare and not defined yet (
In PS/2, they are just repeated sign bits Z3). When a mouse
button is
pressed the corresponding bit is set (e.g. Bit 0 = 1 in Byte 1 when the left mouse button is down).  These four bytes
are followed by Keycode 255 (End of Mouse Data) to ensure integrity on the data link.


Seppo Tiainen 3 November 2004  -   Latest update 9 January 2006