Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

spoll (visa)

Perform serial poll on VISA objects

Syntax

out = spoll(obj)
out = spoll(obj,val)
[out] = spoll(obj)
[out,statusByte] = spoll(obj)
[out] = spoll(obj,val)
[out,statusByte] = spoll(obj,val)

Arguments

obj

A VISA object or an array of VISA objects.

val

A numeric array containing the indices of the objects in obj, that must be ready for servicing before control is returned to the MATLAB® Command Window.

out

The VISA objects ready for servicing.

statusByte

The service request (SRQ) line status byte.

Description

out = spoll(obj) performs a serial poll on the instruments associated with obj. out contains the VISA objects that are ready for servicing. If no objects are ready for servicing, then out is empty.

out = spoll(obj,val) performs a serial poll and waits until the instruments specified by val are ready for servicing. An error is returned if a value specified in val does not match an index value in obj.

Using this syntax, spoll blocks access to the MATLAB Command Window until the objects specified by val are ready for servicing, or a timeout occurs for each object specified by val. The timeout period is specified by the Timeout property.

[out] = spoll(obj) returns the object or an array of objects.

[out,statusByte] = spoll(obj) returns the status byte along with the object or an array of objects.

[out] = spoll(obj,val) returns the object and the value specified in the index value of the object.

[out,statusByte] = spoll(obj,val) returns the status byte along with the object and the value specified in the index value of the object.

Examples

If obj is a four-element array and val is set to [1 3], then spoll will block access to the MATLAB Command Window until the instruments connected to the first and third VISA objects have both requested servicing, or a timeout occurs.

Example of second output argument:

v1 = visa('agilent', 'TCPIP0::yourdomainname.com::inst0::INSTR'); 
v2 = visa('agilent', 'TCPIP0::yourdomainname.com::inst01::INSTR'); 
fopen([v1 v2]);
out1 = spoll(v1);
out2 = spoll([v1 v2], 1);
out3 = spoll([v1 v2], [1 2])
[out4 statusBytes] = spoll([v1 v2])
[out5 statusBytes] = spoll([v1 v2], 2)
fclose([v1 v2]);

More About

collapse all

Tips

Serial polling is a method of obtaining specific information from VISA objects when they request service. When you perform a serial poll, out contains the VISA object that have requested servicing.

If obj is an array of VISA objects

  • Each element of obj must have the same BoardIndex property value.

  • Each element of obj is polled to determine if the instrument is ready for servicing.

If you specify a second output argument when you call an spoll, full serial poll bytes are returned in addition to the SRQ line status in the second argument.

    Note:   To get a list of options you can use on a function, press the Tab key after entering a function on the MATLAB command line. The list expands, and you can scroll to choose a property or value. For information about using this advanced tab completion feature, see Using Tab Completion for Functions.

Introduced in R2010a

Was this topic helpful?