CS-460/560, Week 9B
Spring, 1998
R. Eckert

(See Section 2-5 and Chapter 8 in your text)

Some Physical Input Devices--

   Keyboard--An array of switches. Circuitry/software determines which
   switch (key) is pressed and provides a character code. Graphical
   keyboards can have switches that select customized graphical
   operations and/or dials for scalar (real number) input.

   Mouse--Small hand-held box used to position a cursor on the screen.
   Circuitry provides voltages proportional to the change in x and y
   position of the mouse. Software can use these to move the cursor a
   proportionate amount on the screen. Also has buttons that, when
   pressed or released, can be used to generate program interrupts. Can
   be electro-mechanical or optical.

   Track Ball--An upside-down mouse. Economizes space.

   Joystick--Potentiometers (x,y) generate voltages proportional to the
   distance moved by a lever. Can be used to move cursors or other
   graphical objects on the screen.

   Light Pen--Detects light from screen. When intensity > threshhold, an
   interrupt is generated. From the interval time between the generation
   of the interrupt and the time of the start of a new vertical scan, the
   position on the screen can be computed. Not very precise.

   Graphics Tablets--User moves a stylus (pen) over a grid of charged
   wires. Absolute x,y position of stylus is returned.

   Touch Screen--Impedance (capacitative reactance) of screen material is
   proportional to pressure applied. So When user touches the screen, the
   x,y position can be computed.

   Scanners--Convert an image to a bitmap. Most use an array of CCD
   photodetectors that convert light reflected from the image to an
   electrical (analog) signal. Analog to digital converters produce a
   digital signal that can be stored in a computer. Resolution in dots
   per inch (dpi). Color possible by doing three scans of image.

   Voice Recognition Systems--Sound waves are detected and digitized.
   Amplitud/frequency pattern of the digitized sound samples is compared
   with a "dictionary" of known words/phrases. Many have to be "trained."

3-D Input Devices--Need to provide three coordinate to specify position
in space and three angles (pitch, roll, and yaw) to specify orientation
in space.

   Force Ball--Pushes in different directions, squeezes, twists are
   detected and generate signals proportional to the change in the x, y,
   z position in space and to the change in pitch, roll, and yaw. Can be
   used to control the position and orientation of a cursor in a 3-D

   Digital Glove--Hand gesture/tracking interface device. Magnetic or
   ultrasonic tracking used. Latter has an ultra-sound emitter on the
   glove that is detected by three sensors (tiny microphones). The time
   between emission and detection by each sensor permits a triangulation
   computation of the position of the emitter. More than one emitter
   implies that the orientation of the glove can also be determined.
   Finger-bend sensors provide voltages proportional to the flex of each
   finger. This information can be used to provide gesture information to
   the graphics system, which can interpret different gestures as
   different commands.

There are many other physical input devices.


It is convenient to classify devices into six logical families according
to the kind of data provided by the device. PHIGS and other standard
graphics systems use six logical device categories.

Locator--returns an x,y screen coordinate.

Stroke-- returns a series of screen coordinates. Acts like a locator in a
loop. Good for tasks like interactive sketching.

Pick--Returns an ID of an object or group of objects (structure) being
selected on the screen. The Pick Device control software must keep a list
of objects and the screen area they occupy; when a point is selected with
the Pick Device, a search is made and the current x,y coordinates are
compared with the extent of each object. One or more object IDs are
returned. Result could be ambiguous.

Choice--Selects one of several possible selections; returns an
enumeration type (e.g., selecting a menu item).

String--Returns a character string.

Valuator--Returns a scalar (real number) (e.g., rotation angle, length,
voltage, etc.).

Any physical device can perform any of these logical functions, but some
are more natural than others. For example, a mouse is a natural choice to
implement locator, pick, stroke, and/or choice device functions. A
keyboard is a natural to implement string or valuator device functions.


Measure--The value/values currently associated with the device (i.e., the
data provided by the device.

Event--A change in the state of the device caused by a user action.

Trigger--The user action that produces an event. (We say that the firing
of a trigger initiates an event.) Usually the triggering of an event
causes the current measure to be sent to the application program.


1. Request Mode--Input initiated by program, like a read from a high
level language. Program asks for input and suspends processing until data
is provided by the device. The device does not supply data unless
requested by program.

2. Sample Mode--Program and device operate in parallel (simultaneously,
but independently). Data is provided continuously by the device as the
program executes. The program samples the device as necessary (polling).
Data can be lost if program polling doesn't keep up with the arrival of

3. Event Mode--Input is initiated by the device. Program and device
operate simultaneously in parallel. Incoming data is stored in an "event
queue." Several devices can be active simultaneously. Each device
provides data to the queue whenever the device is "triggered" by the
user. The measure of the device (the data provided) as well as a device
identifier are placed on the queue any time a trigger action occurs. No
data is lost unless the queue becomes full. The program can check the
queue with an enquire function (e.g., AwaitEvent() under PHIGS). If the
queue is non-empty, the function returns immediately and provides the
device identification code of the first event on the queue. If the queue
is empty, the function blocks until either timeout occurs or a new event
occurs. After the enquire function returns with the device ID, other
"Get" functions can be called to input the measure of the device that
provided the data.

Event-Mode I/O on a multitasking system like Windows--

Many applications are running, each with its own event queue. Input
devices operate in event mode; input data/IDs go to O.S., which places
data/ID in the correct application event queue. Applications can read
their event queues and take appropriate action.