<< viOpenDefaultRM VISA Integration Toolbox viRequest >>

VISA Integration Toolbox >> VISA Integration Toolbox > viRead

viRead

Synchronously reads data from device or interface .

Calling Sequence

[status, buf, readCount] = viRead(session, count)

Arguments

status

a real.

buf

a character string.

location of the buffer receiving data from device.

readCount

number of bytes actually transferred.

session

unique logical identifier of a session.

count

number of bytes to be read (size max: 255).

Description

The viRead() operation synchronously transfers data. The data read is stored in the buffer represented by buf. This operation returns only when the transfer is terminated. Only one synchronous read operation can occur at a time.

Examples

[status, defaultRM] = viOpenDefaultRM();

// Send command to get identifier of device located at TCPIP0::ftp.ni.com::21::SOCKET
[status, instr] = viOpen(defaultRM, "TCPIP0::ftp.ni.com::21::SOCKET", viGetDefinition("VI_NULL"), viGetDefinition("VI_NULL"));
[status, count] = viWrite(instr, "*IDN?");

// Read command answer (device identifier)
[status, bufferOut, count] = viRead(instr, 255);
disp(bufferOut);

viClose(instr);
viClose(defaultRM);

Report an issue
<< viOpenDefaultRM VISA Integration Toolbox viRequest >>