/****************************************************************************/ void ad_conf(void)

{

int length = 0, loop = 0;

/* use the "set_commands" array to configure digitizer channel 1 */

char static *set_commands[] =

 

{"CONF1:ARR:VOLT (20),5,(@3)",

/* set 20 readings per burst, 5V range */

"ARM:STAR:SOUR IMM",

/* set arm source immediate */

"ARM:STAR:COUN 2",

/* set 2 bursts (arms) */

"TRIG:STAR:SOUR VME",

/* Data register access triggers readings */

"SENS:SWE:OFFS:POIN -10",

/* set 10 pre-arm readings */

"VINS:CONF:VME:MODE GEN",

/* enable VME bus data transfers */

"VINS:CONF:VME:FEED ’CONV:CHAN1’", /* real time data transfer */

"INIT"};

/* put digitizer in wait-for-arm state */

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_read(long base_addr)

{

int i, readings = 20, index = 0, loop = 0;

float *rdgs, bit;

 

char read_str[80], bit_str[80];

/* command string variables */

/* dynamically allocate memory for readings */

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

/* Create the command string which reads the data register */

sprintf(read_str, "DIAG:PEEK? %ld, %d", base_addr+0x0C,16);

Continued on Next Page

68 Using the Digitizer

Chapter 2

Page 68
Image 68
HP E1429A manual Armstarsour IMM, Armstarcoun