8
By using the make and break commands in Key Number Mode, any
sequence that can by manually typed on a keyboard can be produced
with the USB-ASC232. Use this Key Number Mode to emulate single
keystrokes or even combinations such as Ctrl+F1, or Shift-Alt+F5.
Additional Key Number Mode Control Commands
The USB-ASC232 features two additional commands for keyboard
action. The first command provides a way to clear the keyboard buffer
and is useful for ensuring that no keys are stuck in the “ON” state. The
second command allows for the polling of the keyboard status LED
states. This polling command is useful for checking shift case changes,
or for making sure of the Num Lock state before using Num Lock
affected keys.
0x38
- USB Buffer Clear Command. Sending 0x38 to the
USB-ASC232 serial port results in the device’s internal USB keyboard
buffer being cleared. Use of this command ensures that all made keys
currently in the keyboard buffer are released. The USB-ASC232 will
respond to this command with 0xC7, which is the one’s complement of
the command.
0x7F
- Status LED Read Command. Sending a code 0x7F to the USB-
ASC232 serial port results in the return of a character in the range of ASCII
“0” - “7”. The USB-ASC232 response character reflects the current
state of the Scroll Lock, Caps Lock, and Num Lock LEDs on the computer
system as listed in the chart below.
ASCII Response
Scroll Lock Status Caps Lock Status
Num Lock Status
“0”
Off
Off
Off
“1”
Off
Off
On
“2”
Off
On
Off
“3’
Off
On
On
“4”
On
Off
Off
“5”
On
Off
On
“6”
On
On
Off
“7”
On
On
On
11
[W2] - The most significant bit of the scroll wheel movement
magnitude.
[W1] - Bit 1 of the three bit value for scroll wheel movement.
[W0] - Least significant bit of the scroll wheel movement value.
[1] - Bit 3 of this #4 byte is always “1”. Sending “0” for this bit will
cause the entire mouse control packet to be ignored.
[MM] - State of the middle mouse button. Set to 1 for middle
mouse button on, 0 for the button to be off.
[MR] - State of the right mouse button. Set to 1 for right mouse
button on, 0 for the button to be off.
[ML] - State of the left mouse button. Set to 1 for left mouse
button on, 0 for the button to be off.
NOTES - When sending this 4 byte mouse command packet, the
three bytes following the first 0x00 byte should be sent with no
more than 50msec between the bytes. The 0x00 must always
be followed by 3 additional bytes to complete the mouse control
packet and avoid any confusion between mouse control and
keystroke commands.
The scroll wheel magnitude command is a 4 bit signed value
located in bits Ws through W0, and in the range of 0x00 to 0x07
for up movement, 0x0F to 0x08 for down movement.
The three mouse button bits command the states of the mouse
buttons as seen by the target computer. A “1” in the respective
bit indicates the mouse button is on, while a “0” indicates the
button is not on. Be sure to release any mouse buttons that were
in the on state at a later time once the mouse button task has
completed.