length = (sizeof(set_commands) / sizeof(char*));

/* Execute each command using a loop */

for (loop = 0; loop < length; loop++)

{

IOOUTPUTS(ADDR, set_commands[loop], strlen(set_commands[loop]));

}

/* function call to check for digitizer configuration errors */

check_error("ad_conf");

}

/****************************************************************************/ void ad_fetch(void)

{

char go;

int i = 0, readings = 20; float *rdgs;

/* dynamically allocate memory for readings */

rdgs = malloc(20 * sizeof(float));

/* fetch (retrieve) and print readings */

IOOUTPUTS(ADDR, "FETC1?", 6);

IOENTERA(ADDR, rdgs, &readings);

for (i = 0; i < readings; i++)

{

printf("\nReading %d = %f", i, *rdgs++);

}

free(rdgs - readings);

}

/****************************************************************************/ void rst_clr(void)

{

/* Reset and clear the digitizer */

Continued on Next Page

42 Getting Started

Chapter 1

Page 42
Image 42
HP E1429A manual IOOUTPUTSADDR, FETC1?