
/* initialize the transfer stages by sending three clock pulses to the */ /* internal
sprintf(command, "DIAG:POKE %ld, %d, %d", base_addr+0x08,8,0); IOOUTPUTS(CMD_MOD, command, strlen(command)); IOOUTPUTS(CMD_MOD, command, strlen(command)); IOOUTPUTS(CMD_MOD, command, strlen(command));
/* set the digitizer data register as the
sprintf(command, "DIAG:PEEK? %ld, %d", base_addr+0x02,8); IOOUTPUTS(CMD_MOD, command, strlen(command)); IOENTER(CMD_MOD, &bit_pat);
/* retain register settings, set data register as the clock source */ bit_reg = (int)(bit_pat + ((bit_pat >= 0) ? .5 :
bit_reg = (bit_reg & 0xF3) 0x0B;
sprintf(command, "DIAG:POKE %ld, %d, %d", base_addr+0x02,8,bit_reg); IOOUTPUTS(CMD_MOD, command, strlen(command));
}
/****************************************************************************/ void data_read(long base_addr)
{
/* This function retrieves the new set of readings (those taken on the 1V range) */ /* by reading the data register using the HP E1406 Command Module */
/* DIAGnostic:UPLoad:SADDress? command. Reading the data register places the */ /* readings on the VME (VXI data transfer) bus. */
int *rdgs, i = 0, swap = 0, bytes = 0, length = 1; char rd_mem[80], lf_remove[1];
rdgs = malloc(20 * sizeof(int));
swap = sizeof(int); bytes = 20 * swap;
/* Create the (HP E1406 Command Module) command string which reads the data register */
sprintf(rd_mem, "DIAG:UPL:SADD? %ld, %d", base_addr+0x0C,40);
Continued on Next Page
Appendix C | Register Programming 401 |