9
Key Number Mode Examples
Generation of keystrokes on the target computer is done through
the sending of special one byte codes in the Key Number Mode.
Each standard key of the PC keyboard is assigned a “make” code
to emulate the press of a key, and a “break” code, which results in
the release of the key. The Key Number Table on the page 7
lists each of the supported keys and their corresponding make
and break codes.
From the keycode table, the value of 02 (0x02) can be sent to
the unit to generate the “make” or press and hold of the “1” key.
Sending a byte with a value of 130 (0x82) will result in the release
of the “1” key.
Important:
For any key that has been previously sent a “make”
code, a “break” code of that key must be sent at a later time.
Failure to send the corresponding break code will leave the key in
the down state on the target computer, which may result in unin-
tended keystrokes when new commands are sent. The last key left
in the make state without a break will repeat until the break code
is sent. Never command more than 60 keys in the “make” state
at the same time as this will exceed the standard USB protocol
keyboard buffer length for the USB-ASC232 device.
The use of make and break codes allows the user to create virtu-
ally any keystroke combination. For example, if a sequence of
CTRL+ALT+F1 was needed, the following codes would be sent,
58
(L Ctrl make),
60
(L Alt make),
112
(Make F1),
240
(Break
F1),
188
(Break L Alt),
186
(Break L Ctrl).
The example above assumes that the handshaking USB-ASC232
is seen as not busy before sending the next command byte to the
unit.
Producing Mouse Action on the Target PC
The USB-ASC232 is capable of controlling the mouse cursor and
mouse button states through a special four byte command sequence.
This command sequence can be used in any of the operating modes
of the USB-ASC232.
The four byte mouse control sequence is construced as follows:
Byte #1 Byte #2 Byte #3 Byte #4
[Command] [X Movement] [Y Movement] [Scroll/Buttons]
Byte #1 - Always a 0x00 value, indicates start of packet.
Byte #2 - Signed byte for the magnitude of X direction movement.
Values 0x01 to 0x7F move the cursor right, values 0xFF to 0x81
move it left. A 0x00 Value produces no X direction movement.
Byte #3 - Signed byte for the magnitude of Y direction movement.
Values 0x01 to 0x7F move the cursor down, values 0xFF to 0x81
move the cursor up. A 0x00 produces no Y movement.
Byte #4 - Byte for Scroll Wheel movement and mouse button
control. The upper 4 bits of this byte contain a signed value for
scroll wheel movement, while the lower 3 bits command the mouse
Left, Right, and Middle button activation and deactivation.
This Byte #4 is constructed as shown,
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
[Ws] [W2] [W1] [W0] [1] [MM] [MR] [ML]
[Ws] - The sign of the scroll wheel movement. A zero in this bit
commands up movement on the scroll wheel, a one in this bit
produces down scroll wheel movement. Movement magnitude
based on the signed value in Ws through W0 values.
10