/* Send the DIAG:UPL:SADD? command which accesses the data register */ /* and retrieves the readings */

IOOUTPUTS(CMD_MOD, rd_mem, strlen(rd_mem)); /* retrieve and enter the readings, */

IOENTERAB(CMD_MOD, rdgs, &bytes, swap);

/* remove the block header */

/* remove the line feed which trails the last data byte */ IOENTERS(CMD_MOD, lf_remove, &length);

/* convert and print each reading as a voltage */

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

{

rdgs[i] /= 16; /* remove label from each 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)

{

/* This function returns the digitizer’s A24 base address. */

/* digitizer logical address */

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

/* base address of (A24) offset register in A16 address space */ long base_addr = (0x1FC000 + (logical_addr * 64)) + 6;

float a24offst;

/* A24 offset from A16 offset register */

char rd_addr[80];

/* command string variable */

/* Create the command string which reads the A24 base address */ sprintf(rd_addr, "DIAG:PEEK? %ld, %d", base_addr,16);

/* Send DIAG:PEEK? command */ IOOUTPUTS(CMD_MOD, rd_addr, strlen(rd_addr));

/* Read value from offset register */ IOENTER(CMD_MOD, &a24offst);

Continued on Next Page

402 Register Programming

Appendix C

Page 402
Image 402
HP E1429A manual On Next