Specifications

114 Appendix Error! Main Document Only.Error! Main Document Only.6 - Optional
Software Protocols
Polled vs. Interrupt Mode
The host processing can be performed by polling the controller or by using
interrupts when in E271-141 emulation mode. Polling consists of constantly
checking the status of the controller for data to become ready, and then retrieving
that data. Polled or Interrupt Mode is selected by jumpers J2 and J3 (see Selecting
the Interrupt (IRQ), page 19).
Polling Considerations
In Polled Mode, bit 7 (data ready) of the emulated status register (see page 112)
must be checked continuously. If it is a 1, the data registers contain the
coordinates of a touch and can be read. If it is a 0, no data is ready.
Bit 0 of the status register indicates whether the controller is in 8 or 12-Bit Mode.
A 1 indicates 8-Bit Mode; a 0 indicates 12-Bit Mode.
In 8-Bit Mode, a single two-byte transfer will read both the X and Y coordinates.
The application program must read X before Y because reading Y signals the
controller to transmit new data as soon as it becomes available.
In 12-Bit Mode, two separate two-byte transfers are required to read the X and Y
coordinates. The first two-byte transfer returns the high and low-order bytes of X.
You must poll a second time to obtain the second two-byte transfer, which returns
the high and low-order bytes of Y. Bit 6 of the status register indicates whether X
or Y is being read. If bit 6 is 1, it is X data; if it is 0, Y data. In both cases, you
must read the high-order byte before the low-order byte because reading the low-
order byte signals the controller to transmit new data as soon as it becomes
available.
Polled Programming Example
The following program polls the E271-2201 controller in E271-141 emulation
mode. The code supports both 8 and 12-Bit Modes.
Here is typical output:
C:>bpgettch
Touch screen for polled coordinate output.
Press any key to abort...
X=1408 Y=1104
X=1424 Y=1120
X=1424 Y=1136
X=1440 Y=1152
X=1456 Y=1152
X=1456 Y=1136
NOTE
The 8-bit data is the same as the highest-order 8 bits of the 12-bit data.