Command 23 takes two bytes. The first byte
controls which presses are reported. The second byte
controls which releases are reported.
Each of the two bytes are composed of a bit mask. Do not
let "byte" freak you out, it is just a number that can
only be between 0 and 255. A bitmask is just a number
(typically a byte)where each of the digits (in binary)
acts like a switch to turn something on or off.
The valid range of the bit mask for the keys in the 633
is 0-63 (decimal) or 0x00 to 0x3F (hexadecimal) or
0b00000000 to 0b00111111 (binary). Notice that there are
six "1" digits in the binary form, and six keys on the
633.
You might be wondering about the "0x"and "0b" prefixes
on the numbers above. "0x" is a fairly well accepted
prefix meaning "the following digits are in
"hexadecimal" (it is the syntax for a computer language
called "C"). "0b" is a prefix that means "the following
digits are in binary". No prefix is taken to mean
"normal" numbers like you use every day, which are base
10. Base 10 is handy for people with ten fingers. Binary
(base 2) is handy for computers, which generally use two
logic states. Hexadecimal is useful for programmers-
which were raised using base ten fingers, but work on
computers.
If you group four bits (a BIT is a Binary digIT) digits,
then this is one hexadecimal (hex, for short) digit.
Hex digits count 0-9 like we all do, and then add A-F on
top of that. One hex digit (or 4 bits) is called a
nibble (or sometimes spelled nybble). It makes a bit
(sorry) of sense that half a byte would be a nybble, I
guess.
decimal = binary = hex
0 = 0b0000 = 0x0
1 = 0b0001 = 0x1
2 = 0b0010 = 0x2
3 = 0b0011 = 0x3
4 = 0b0100 = 0x4
5 = 0b0101 = 0x5
6 = 0b0110 = 0x6
7 = 0b0111 = 0x7
8 = 0b1000 = 0x8
9 = 0b1001 = 0x9
10 = 0b1010 = 0xA
11 = 0b1011 = 0xB
12 = 0b1100 = 0xC
13 = 0b1101 = 0xD
14 = 0b1110 = 0xE
15 = 0b1111 = 0xF
Experiment: Open up calculator (Start -> Programs ->
Acessories -> Calculator). Type in 63. Click "View",
"Scientific". Then play around with the "Hex", "Dec",
and "Bin" keys.
Ok, back to the 633 :)
Each bit in the bitmask corresponds to a key on the
633. Here are the definitions:
key decimal = hex = binary
UP 1 = 0x01 = 0b00000001
ENTER 2 = 0x02 = 0b00000010
CANCEL 4 = 0x04 = 0b00000100
LEFT 8 = 0x08 = 0b00001000
RIGHT 16 = 0x10 = 0b00010000
DOWN 32 = 0x20 = 0b00100000
Now the decimal and hex numbers do not make much sense,
but look how nice the binary numbers look! So lets say
you only wanted the arrow keys on the 633 to be active.
In tat case just add up the values of the individual bit
masks:
key decimal = hex = binary
UP 1 = 0x01 = 0b00000001
LEFT 8 = 0x08 = 0b00001000
RIGHT 16 = 0x10 = 0b00010000
DOWN 32 = 0x20 = 0b00100000
== ==== ==========
57 = 0x39 = 0b00111001
See, the binary math is pretty simple--why, you could
teach a transistor to do it. So now go back to
calculator, switch to "bin" put in 00111001, switch to
"dec" and there you have what you need to send to put as
the data field in 633_WinTest to allow only presses of
the arrow keys. (Of course you can also add up the
decimal column to come up with 57 directly, but where is
the fun in that?)
633_WinTest uses a special syntax to send raw bytes (non
ASCII, look it up :)). It is a backslash followed by
three decimal digits. This syntax allows "binary"
(sorry, in this usage it simply means "non-ASCII" not
the same "binary" as we were talking about above) bytes
such as a null (0 dec = 0x00 hex = 0b00000000 binary).
So to send a null, you just put in \000. Or to send 57
you put \057.
Now we (the [i]academic[/i] "we") know enough to send
the data to the 633 using 633_WinTest:
Command 23
\057\000
I think your original request was to do all the key
presses, and no releases. Here is what to send for that:
Command 23
\063\000
Hopefully that will get you going. Do not forget to
use Command 4 if you want to make the changes
permanent.