Main Content

mempoke

(To be removed) Low-level memory write to VXI register

This visa object function will be removed in a future release. Use visadev object functions instead. For more information, see Compatibility Considerations.

Syntax

mempoke(obj,data,offset)
mempoke(obj,data,offset,'precision')

Arguments

obj

A VISA-VXI or VISA-GPIB-VXI object.

data

The data written to the memory address.

offset

The offset in the mapped memory space to which the data is written.

'precision'

The number of bits to write to the memory address.

Description

mempoke(obj,data,offset) writes the uint8 value specified by data to the mapped memory address specified by offset for the object obj.

mempoke(obj,data,offset,'precision') writes data using the number of bits specified by precision. precision can be uint8, uint16, or uint32, which instructs mempoke to write data as 8-, 16-, or 32-bit values, respectively. precision can also be single, which instructs mempoke to write data as single-precision values.

Examples

Create the VISA-VXI object vv associated with a VXI chassis with index 0, and a Keysight® E1432A digitizer with logical address 130.

vv = visa('keysight','VXI0::130::INSTR');
fopen(vv)

Use memmap to map 16 bytes in the A16 address space.

memmap(vv,'A16',0,16)

Perform a low-level write to the fourth instrument register, which has an offset of 6.

mempoke(vv,45056,6,'uint16')

Unmap the memory and disconnect vv from the instrument.

memunmap(vv)
fclose(vv)

Tips

Before you can write to the VXI register, obj must be connected to the instrument with the fopen function. A connected interface object has a Status property value of open. An error is returned if you attempt a write operation while obj is not connected to the instrument.

You must map the memory space using the memmap function before using mempoke. The MappedMemorySize property returns the size of the memory space mapped.

offset indicates the offset in the mapped memory space to which the data is written. For example, if the mapped memory space begins at 200H, the offset is 2, and the precision is uint8, then the data is written to memory location 202H. If the precision is uint16, the data is written to 202H and 203H.

To increase speed, mempoke does not return error messages from the instrument.

Version History

Introduced before R2006a

collapse all

R2021a: visa object interface will be removed

Use of this function with a visa object will be removed. To access a VISA resource, use a visadev object with its functions and properties instead.

The recommended functionality has additional capabilities and improved performance. See Transition Your Code to visadev Interface for more information about using the recommended functionality.