During Spring quarter, 1999, Adnan Sulejmanpasic
and Daniel Parshall used the same touch screen we used for their CSE 477
project. Much of the content in this subsection is taken from their
report. A complete copy of their report can be found online at: http://www.cs.washington.edu/education/courses/477/99sp/projectwebs/groupa
We did not have to program the touch screen in any
way to get it to send the coordinates of a user’s touch. Touch screen
specifications from Keytec Support, the maker of our touch screen is included
in the appendix to this report. In short, these specifications say
that the touch screen sends a header byte, and then four more bytes that
contain information about the coordinates of the touch. The header
byte indicates whether the screen has been touched (0xC2) or untouched
(0xC0). When the user touches the screen it keeps sending data for as long
as the finger is in contact with the screen (thus allowing us to support
dragging in our project). Otherwise the touch screen sends the coordinates
of the untouch (when the user lifts his finger off the screen).
The touch screen sends the data in the above format with the only exception
that it never sends two bytes to describe the coordinate if only one byte
is sufficient. For example:
If the touch screen sends: 0xC2, 0x01, 0x11, 0x03,
0x23, it means the user touched the screen at x-coordinate (0x01<<8
+ 0x11) and y-coordinate (0x03<<8 + 0x23), i.e. at (273, 803).
If the touch screen sends: 0xC2, 0x20, 0x03, 0x23, only the first byte
following the header byte represents the x-coordinate, and the other two
bytes represent the y-coordinate, i.e. user touched the screen at (32,
803).
If the touch screen sends: 0xC2, 0x0A, 0x0B, the first byte following
the header byte is the x-coordinate and the second byte is the y-coordinate,
i.e. user touched the screen at (10, 11).
The touch screen resolution is approximately 1900x1900 (with the origin of the x- and y- axes being in the top left corner), implying that the most significant byte (when the coordinate is represented with two bytes) can never be greater than 0x07. If the touch screen sends four bytes after the header byte, we know that the first two bytes are for the x-coordinate, and the last two bytes are for the y-coordinate. If the touch screen sends only two bytes, we know that the first byte is the x-coordinate, and the second one is the y-coordinate. If the touch screen sends three bytes we determine which coordinate is represented with one byte and which coordinate with two bytes according to the following scheme:
if the first byte after the header ³ 0x07, then:
the x-coordinate is represented with only the first
byte and the remaining two bytes describe the y-coordinate
else
the first two bytes describe the x-coordinate and
the remaining byte describes the y-coordinate
Notice that we would get erroneous interpretation
of the touch if the user touches the screen all the way to the left, i.e.
in the portion of the screen where 0 < x-coordinate < 7. This,
however, is very difficult to achieve because of the screen's high resolution,
so we did not experience any problems.