User`s guide
96 Agilent VISA User’s Guide
4 Programming via GPIB and VXI
/* Maps to A24 address space */
viMapAddress(vi, VI_A24_SPACE, 0x00, 0x80,
VI_FALSE,
VI_NULL,&address);
Reading and Writing to Device Registers
When you have mapped the memory space, use the VISA low-level
memory functions to access the device's registers. First, determine
which device register you need to access. Then, you need to know the
register's offset. See the applicable instrument’s user manual for a
description of the registers and register locations. You can then use this
information and the VISA low-level functions to access the device
registers.
Sample: Using viPeek16
A code sample using viPeek16 follows.
ViSession defaultRM, vi;
ViUInt16 value;
ViAddr address;
ViUInt16 value;
.
.
viOpenDefaultRM(&&defaultRM);
viOpen(defaultRM, "VXI::24::INSTR", VI_NULL,
VI_NULL,
&vi);
viMapAddress(vi, VI_A16_SPACE, 0x00, 0x04,
VI_FALSE,
VI_NULL, &address);
viPeek16(vi, addr, &value)
Unmapping Memory Space
Make sure you use the viUnmapAddress function to unmap the
memory space when it is no longer needed. Unmapping memory space
makes the window available for the system to reallocate.