/****************************************************************************/ void mem_read(long base_addr)

{

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

char rd_mem[80];

/* command string variable */

/* dynamically allocate memory for readings */

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

/* Create the (HP E1406 Command Module) command string which reads the data register */

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

/* Send DIAG:PEEK? command which accesses the data register */ /* and triggers measurements, and then retrieve measurements */

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

{

IOOUTPUTS(CMD_MOD, rd_mem, strlen(rd_mem));

IOENTER(CMD_MOD, &rdgs[i]);

}

/* Print a subset of the readings */ for (i = 0;i < 20;i++)

{

rdgs[i] /= 16; /* remove label from reading */

if (rdgs[i] >= 2047 rdgs[i] <= -2046) printf("\nReading overrange");

else

printf("\nReading %d = %.6E", i, (rdgs[i] * 0.0005));

}

free(rdgs);

}

/****************************************************************************/ long get_base_addr(void)

{

/* digitizer logical address */

long logical_addr = (ADDR - 70900L) * 8;

Continued on Next Page

Chapter 2

Using the Digitizer 65

Page 65
Image 65
HP E1429A manual On Next