viIn8/viIn16/viIn32/viIn64, viIn8Ex/viIn16Ex/viIn32Ex/viIn64Ex

NI-VISA

viIn8/viIn16/viIn32/viIn64, viIn8Ex/viIn16Ex/viIn32Ex/viIn64Ex

Purpose

Reads in an 8-bit, 16-bit, 32-bit, or 64-bit value from the specified memory space and offset.

C Syntax

ViStatus viIn8(ViSession vi, ViUInt16 space, ViBusAddress offset, ViPUInt8 val8)

ViStatus viIn16(ViSession vi, ViUInt16 space, ViBusAddress offset, ViPUInt16 val16)

ViStatus viIn32(ViSession vi, ViUInt16 space, ViBusAddress offset, ViPUInt32 val32)

ViStatus viIn64(ViSession vi, ViUInt16 space, ViBusAddress offset, ViPUInt64 val64)

ViStatus viIn8Ex(ViSession vi, ViUInt16 space, ViBusAddress64 offset, ViPUInt8 val8)

ViStatus viIn16Ex(ViSession vi, ViUInt16 space, ViBusAddress64 offset, ViPUInt16 val16)

ViStatus viIn32Ex(ViSession vi, ViUInt16 space, ViBusAddress64 offset, ViPUInt32 val32)

ViStatus viIn64Ex(ViSession vi, ViUInt16 space, ViBusAddress64 offset, ViPUInt64 val64)

Visual Basic Syntax

viIn8&(ByVal vi&, ByVal space%, ByVal offset&, val8 as Byte)

viIn16&(ByVal vi&, ByVal space%, ByVal offset&, val16%)

viIn32&(ByVal vi&, ByVal space%, ByVal offset&, val32&)

Resource Classes

FireWire INSTR, GPIB-VXI INSTR, GPIB-VXI MEMACC, PXI INSTR, PXI MEMACC, VXI INSTR, VXI MEMACC

Parameters

Name Direction Description

vi

IN

Unique logical identifier to a session.

space

IN

Specifies the address space. Refer to the table included in the Description section for more information.

offset

IN

Offset (in bytes) of the address or register from which to read. For viInXX() operations, this is a 32-bit value for 32-bit applications and a 64-bit value for 64-bit applications. For viInXXEx() operations, this is always a 64-bit value.

val8, val16, val32 or val64

OUT

Data read from bus (8 bits for viIn8[Ex](), 16 bits for viIn16[Ex](), 32 bits for viIn32[Ex](), and 64 bits for viIn64[Ex]()).

Return Values

Completion Codes Description

VI_SUCCESS

Operation completed successfully.

 

Error Codes Description

VI_ERROR_INV_OBJECT

The given session reference is invalid.

VI_ERROR_NSUP_OPER

The given vi does not support this operation.

VI_ERROR_RSRC_LOCKED

Specified operation could not be performed because the resource identified by vi has been locked for this kind of access.

VI_ERROR_BERR

Bus error occurred during transfer.

VI_ERROR_INV_SPACE

Invalid address space specified.

VI_ERROR_INV_OFFSET

Invalid offset specified.

VI_ERROR_NSUP_OFFSET

Specified offset is not accessible from this hardware.

VI_ERROR_NSUP_WIDTH

Specified width is not supported by this hardware.

VI_ERROR_NSUP_ALIGN_OFFSET

The specified offset is not properly aligned for the access width of the operation.

VI_ERROR_INV_SETUP

Unable to start operation because setup is invalid (due to attributes being set to an inconsistent state).

Description

The viInXX[Ex]() operations use the specified address space to read in 8, 16, 32, or 64 bits of data, respectively, from the specified offset. These operations do not require viMapAddress() to be called prior to their invocation.

The following table lists the valid entries for specifying address space.

Value Description

VXI, VME, and GPIB-VXI

VI_A16_SPACE (1)
VI_A24_SPACE (2)
VI_A32_SPACE (3)
VI_A64_SPACE (4)

PXI INSTR

VI_PXI_CFG_SPACE (10)
VI_PXI_BAR0_SPACE (11) to VI_PXI_BAR5_SPACE (16)

PXI MEMACC

VI_PXI_ALLOC_SPACE (9)

FireWire INSTR

VI_FIREWIRE_DFLT_SPACE (5)

INSTR Specific

Notice that the offset parameter to these operations for an INSTR Resource is the offset address relative to the device's allocated address base for the corresponding address space that was specified. For example, if space specifies VI_A16_SPACE, then offset specifies the offset from the logical address base address of the specified VXI device. If space specifies VI_A24_SPACE or VI_A32_SPACE, then offset specifies the offset from the base address of the VXI device's memory space allocated by the VXI Resource Manager within VXI A24 or A32 space.

To specify the full 48-bit offset for these methods on a FireWire INSTR session, a call to viSetAttribute using VI_ATTR_FIREWIRE_SRC_UPPER_OFFSET is needed prior to calling these methods. Subsequent calls to viSetAttribute are needed only if the upper 16 bits of the FireWire offset change.

MEMACC Specific

For a MEMACC Resource, the offset parameter specifies an absolute address.


Related Topics

INSTR Resource

MEMACC Resource

VI_ATTR_FIREWIRE_SRC_UPPER_OFFSET

viOut8/viOut16/viOut32/viOut64, viOut8Ex/viOut16Ex/viOut32Ex/viOut64Ex