Using Low/High-Level Memory I/O Methods

From Agilent VISA.NET

Using Low/High-Level Memory I/O Methods

VISA supports three different memory I/O methods for accessing memory on the VXI backplane, as shown. All three of these access methods can be used to read and write VXI memory in the A16, A24, A32, and A64 address spaces. The best method to use depends on the VISA program characteristics.

  • Low-level viPeek/viPoke
    • viMapAddress
    • viUnmapAddress
    • viPeek8, viPeek16, viPeek32, viPeek64
    • viPoke8, viPoke16, viPoke32, viPoke64
  • High-level viIn/viOut
    • viIn8, viIn16, viIn32, viIn64
    • viOut8, viOut16, viOut32, viOut64
  • High-level viMoveIn/viMoveOut
    • viMoveIn8, viMoveIn16, viMoveIn32, viMoveIn64
    • viMoveOut8, viMoveOut16, viMoveOut32, viMoveOut64

Using Low-Level viPeek/viPoke

Low-level viPeek/viPoke is the most efficient in programs that require repeated access to different addresses in the same memory space.

The advantages of low-level viPeek/viPoke are:

  • Individual viPeek/viPoke calls are faster than viIn/viOut or viMoveIn/viMoveOut calls.
  • Memory pointers may be directly de-referenced in some cases for the lowest possible overhead.

The disadvantages of low-level viPeek/viPoke are:

  • A viMapAddress call is required to set up mapping before viPeek/viPoke can be used.
  • viPeek/viPoke calls do not return status codes.
  • Only one active viMapAddress is allowed per vi session.
  • There may be a limit to the number of simultaneous active viMapAddress calls per process or system.

Using High-Level viIn/viOut

High-level viIn/viOut calls are best in situations where a few widely scattered memory accesses are required and speed is not a major consideration.

The advantages of high-level viIn/viOut are:

  • It is the simplest method to implement.
  • There is no limit on the number of active maps.
  • A16, A24, A32, and A64 memory access can be mixed in a single vi session.

The disadvantage of high-level viIn/viOut calls is that they are slower than viPeek/viPoke.

Using High-Level viMoveIn/viMoveOut

High-level viMoveIn/viMoveOut calls provide the highest possible performance for transferring blocks of data to or from the VXI backplane. Although these calls have higher initial overhead than the viPeek/viPoke calls, they are optimized on each platform to provide the fastest possible transfer rate for large blocks of data.

For small blocks, the overhead associated with viMoveIn/viMoveOut may actually make these calls longer than an equivalent loop of viIn/viOut calls. The block size at which viMoveIn/viMoveOut becomes faster depends on the particular platform and processor speed.

The advantages of high-level viMoveIn/viMoveOut are:

  • They are simple to use.
  • There is no limit on number of active maps.
  • A16, A24, A32, and A64 memory access can be mixed in a single vi session.
  • They provide the best performance when transferring large blocks of data.
  • They support both block and FIFO mode.

The disadvantage of viMoveIn/viMoveOut calls is that they have higher initial overhead than viPeek/viPoke.

Sample: Using VXI Memory I/O

The memio.c sample program demonstrates how to use the various types of VXI memory I/O.