initiate(base_addr);

/* function call which prepares memory to store readings */

memory_retrieve(base_addr);

/* function call which prepares memory to retrieve readings */

data_read(base_addr);

/* function call which reads the data register */

}

/****************************************************************************/ void conf_read(void)

{

/* This function uses the CONFigure command to set up 20 readings on the */ /* 5V range. The READ? command is used to take the readings. */

char go;

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

/* dynamically allocate memory for readings */

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

/* configure the digitizer for 20 readings, 5V range, on input */ /* port 3 */

IOOUTPUTS(ADDR, "CONF1:ARR:VOLT (20),5,(@3)", 26);

/* check for errors in the CONFigure command */

check_error("conf_read");

/* initiate the digitizer and read (fetch) the readings */

IOOUTPUTS(ADDR, "READ?", 5);

IOENTERA(ADDR, rdgs, &readings);

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

{

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

}

free(rdgs);

printf("\nPress Enter (return) to change configuration with register reads and writes"); scanf("%c", go);

}

Continued on Next Page

Appendix C

Register Programming 391

Page 391
Image 391
HP E1429A manual Iooutputsaddr, Read?