HP (Hewlett-Packard) B Network Router User Manual


 
/****************************************************************************/
void input_config(long base_addr)
{
/* This function changes the measurement range from 5V as set by the CONFigure */
/* command, to 1V using the A/D shift register. The range is changed by */
/* enabling/disabling various attenuators on the input signal path. */
int shift_count = 55, bit_set = 0;
float bit = 0;
char stat_read[80], stat_write[80], strobe_write[80];
/* create DIAG:PEEK? command which reads the A/D status register */
sprintf(stat_read, "DIAG:PEEK? %ld, %d", base_addr+0x03,8);
/* Set channel 1 range to 1V by setting bits 38, 37, 35, 34, and 10 */
/* as required in the A/D shift register. */
for(shift_count = 55; shift_count >= 0; shift_count--)
{
switch (shift_count)
{
/* turn channel 1 14 dB internal attenuator off */
/* read bit 38 by reading the A/D status register */
case 38:IOOUTPUTS(CMD_MOD, stat_read, strlen(stat_read));
IOENTER(CMD_MOD, &bit);
/* set bit 38 to ’1’ by writing to the A/D serial register */
sprintf(stat_write,"DIAG:POKE %ld, %d, %d", base_addr+0x05,8,1);
IOOUTPUTS(CMD_MOD, stat_write, strlen(stat_write));
break;
/* turn channel 1 6 dB internal attenuator off */
/* read bit 37 by reading the A/D status register */
case 37:IOOUTPUTS(CMD_MOD, stat_read, strlen(stat_read));
IOENTER(CMD_MOD, &bit);
/* set bit 37 to ’1’ by writing to the A/D serial register */
sprintf(stat_write,"DIAG:POKE %ld, %d, %d", base_addr+0x05,8,1);
IOOUTPUTS(CMD_MOD, stat_write, strlen(stat_write));
break;
Continued on Next Page
392 Register Programming Appendix C