HP (Hewlett-Packard) B Network Router User Manual


 
/****************************************************************************/
void initiate(long base_addr)
{
/* This function initializes and initiates the timebase processor. This includes */
/* initializing the processor, setting the trigger (post-arm) count, setting */
/* the sample rate, setting the A/D as the data source for memory, and initiating */
/* the timebase processor. Note that the registers must be read and written to */
/* in the sequence shown. */
char command[80];
float bit_pat = 0;
int *addr_ptr, *data_ptr, bit_reg = 0;
int tb_addr [] = {0x41,0x5F, 0x65, 0x67, 0x69, 0x6B, 0x7D, 0x7F, -1};
int tb_data [] = {0, 1, 1, 5, 0, 0, 0, 0};
data_ptr = tb_data;
/* reset the timebase processor by writing the values to the corresponding */
/* registers shown above */
for (addr_ptr = tb_addr; *addr_ptr != -1; addr_ptr++)
{
sprintf(command, "DIAG:POKE %ld, %d, %d", base_addr + *addr_ptr, 8, *(data_ptr++));
IOOUTPUTS(CMD_MOD, command, strlen(command));
}
/* since only post-arm readings are taken, set the pre-arm reading count */
/* to 1 */
/* write least significant byte of pre-arm count */
sprintf(command, "DIAG:POKE %ld, %d, %d", base_addr+0x73,8,1);
IOOUTPUTS(CMD_MOD, command, strlen(command));
/* write most-significant-byte of pre-arm count */
sprintf(command, "DIAG:POKE %ld, %d, %d", base_addr+0x75,8,0);
IOOUTPUTS(CMD_MOD, command, strlen(command));
/* set the trigger count (post-arm readings only) by loading the post-arm */
/* reading count registers. This program sets up 20 post-arm readings. */
/* write least-significant-byte of post-arm count (count - 3) */
sprintf(command, "DIAG:POKE %ld, %d, %d", base_addr+0x77,8,17);
IOOUTPUTS(CMD_MOD, command, strlen(command));
Continued on Next Page
396 Register Programming Appendix C