Agilent Technologies FS2010 User's Guide Page 113

  • Download
  • Add to my manuals
  • Print
  • Page
    / 160
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 112
Programming via GPIB and VXI 4
Agilent VISA User’s Guide 113
registers of the device at GPIB-VXI0::24. Change
this address if necessary. Register contents are
then displayed.*/
#include <visa.h>
#include <stdlib.h>
#include <stdio.h>
void main () {
ViSession defaultRM, dmm;
ViAddr address;
unsigned short id_reg, devtype_reg;
/* Open session to VXI device at address 24 */
viOpenDefaultRM(&defaultRM);
viOpen(defaultRM, "GPIB-VXI0::24::INSTR",
VI_NULL,
VI_NULL,&dmm);
/* Map into memory space */
viMapAddress(dmm, VI_A16_SPACE, 0x00, 0x10,
VI_FALSE,
VI_NULL, &address);
/* Read instrument id register contents */
viPeek16(dmm, address, &id_reg);
/* Read device type register contents */
/* ViAddr is defined as a void so we must
cast it to something else to do pointer
arithmetic */
viPeek16(dmm, (ViAddr)((ViUInt16 *)address +
0x01),
&devtype_reg);
/* Unmap memory space */
viUnmapAddress(dmm);
/* Print results */
printf ("ID Register = 0x%4X\n", id_reg);
printf ("Device Type Register = 0x%4X\n",
devtype_reg);
Page view 112
1 2 ... 108 109 110 111 112 113 114 115 116 117 118 ... 159 160

Comments to this Manuals

No comments