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

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

{

IOOUTPUTS(ADDR_MEM, memory[loop], strlen(memory[loop]));

}

/* check for configuration errors */

check_error("digitizer", ADDR);

check_error("memory", ADDR_MEM);

}

/****************************************************************************/ void initiate(void)

{

int i = 0, readings = 20, swap = 0, bytes = 0, length = 1, *rdgs; float rdy;

char lf_remove[1];

/* dynamically allocate memory for readings */

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

/* allocate computer memory for reading storage */

swap = sizeof(int);

/* each reading in memory is two bytes */

bytes = 20 * swap;

/* read 40 bytes (2 channels, 10 readings per channel) */

IOOUTPUTS(ADDR_MEM, "INIT", 4);

/* initiate the memory card */

IOOUTPUTS(ADDR_MEM, "*OPC?", 5); /* wait for INIT to parse before continuing */

IOENTER(ADDR_MEM, &rdy);

 

/* enter *OPC? response from memory card */

IOOUTPUTS(ADDR, "INIT", 4);

 

/* initiate the digitizer */

IOOUTPUTS(ADDR, "*OPC?", 5); /* allow readings to complete before */

 

/* retrieving them from the memory card */

IOENTER(ADDR, &rdy);

/* enter *OPC? response from digitizer */

IOOUTPUTS(ADDR_MEM, "TRAC:DATA? SET2", 15); /* retrieve readings from memory card

*/

IOENTERAB(ADDR_MEM, rdgs, &bytes, swap); /* enter readings and remove block header */

/* remove line feed which trails the last data byte */

IOENTERS(ADDR_MEM, lf_remove, &length);

Continued on Next Page

Chapter 2

Using the Digitizer 85

Page 85
Image 85
HP E1429A manual IOOUTPUTSADDRMEM, Init, IOOUTPUTSADDR, Init