Specifications

58 Chapter 5 - Software Interface
Example1 - Display Controller Defaults and Raw Touch Coordinates
EXAMPLE1.C polls Elo SmartSet touchscreen controllers. The controller ID,
jumper settings, and power on diagnostics results are displayed, as shown in Figure
5-4 on the following page. Raw touch coordinates are then displayed, along with
the status flag, indicating initial touch, stream touches, and untouch.
C:\>example1
ID:
Controller revision level: EloInc. 1.2
Z axis: Not available
Jumper settings:
Touchscreen type: AccuTouch
Interface: PC-Bus
Boot from: Jumpers
Mode: Stream
Interrupt: 0
Base address: 280
Touch screen for polled [X Y Z Status] output.
Press any key to abort...
1203 2846 255 1
1376 2691 255 2
1651 2457 255 2
1903 2272 255 2
2280 1980 255 2
2515 1773 255 4
Figure 5-4. EXAMPLE1.C Output
In the following source code, initcontroller(), defined in SERIAL.C or BUS.C,
detects and initializes the controller. An error condition aborts the program with a
message describing the problem. The querycommand(), checkdiags(), and
gettouch() functions are defined in PACKET.C. Source code for these modules is
included later in this chapter. Refer to the Command Reference in Chapter 6 for
the structure of the owner, id, jumpers, and diag packets used in displayjumpers().
/*************************************************************************
EXAMPLE1.C
Polls Elo SmartSet touchscreen controllers.
Displays controller ID, jumper settings, and raw touch coordinates.
**************************************************************************/
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "packet.c" /* SmartSet interface independent code */
#include "pc_misc.c" /* miscellaneous PC dependent code */
void displayjumpers(void);
/*************************************************************************/
int main(void)
{
int x,y,z,flags;
initcontroller();
checkdiags();
displayjumpers();
printf("\nTouch screen for polled [X Y Z Status] output.\n");
printf("Press any key to abort...\n");
do {
if (gettouch(&x,&y,&z,&flags))
printf("%6d%6d%6d%6X\n",x,y,z,flags);
} while (!kbhit());
while (kbhit()) /* flush keystroke */
getch();
disablecontroller();