HP (Hewlett-Packard) B Network Router User Manual


 
for (loop = 0; loop < length; loop++)
{
IOOUTPUTS(ADDR_MEM, memory[loop], strlen(memory[loop]));
}
/* check for digitizer configuration errors */
check_error("digitizer1", ADDR_G);
check_error("digitizer2", ADDR_I);
check_error("memory", ADDR_MEM);
}
/****************************************************************************/
void initiate(long base_addr)
{
int i = 0, readings = 20, swap = 0, bytes = 0, length = 1, *rdgs;
int bit_reg = 0;
float rdy, bit_pat = 0;
char lf_remove[1], command[80];
/* 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 */
/* create DIAG:PEEK? command which reads the generator digitizer’s */
/* arm source register */
sprintf(command, "DIAG:PEEK? %ld, %d", base_addr+0x49,8);
IOOUTPUTS(CMD_MOD, command, strlen(command));
IOENTER(CMD_MOD, &bit_pat);
/* retain register settings, set arm source 1 slope to positive */
bit_reg = (int)(bit_pat + ((bit_pat >= 0) ? .5 : -.5));
bit_reg = (bit_reg & 0xF7);
sprintf(command, "DIAG:POKE %ld, %d, %d", base_addr+0x49,8,bit_reg);
IOOUTPUTS(CMD_MOD, command, strlen(command));
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_G, "INIT", 4); /* initiate the generator digitizer */
Continued on Next Page
96 Usin
g
the Di
g
itizer Chapter 2