Skip to Main Content Skip to Search
Product Documentation

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.

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

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.

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]);

See Also

BoardIndex | spoll | Timeout | visa

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS