MCS260B
CORNERSTONE 260B MONOCHROMATORS
61
15.8 COMMAND SYNCHRONIZATION
The CS260B has commands that allow an application to coordinate some of its operations. For
example,
a customer’s application may need to wait for the grating rotation stage to reach a
wavelength before it begins to read a detector. The pseudo-code for this would be:
•
Send wavelength command;
•
Wait for wavelength operation (stage rotation) to finish;
•
Read detector.
Sequential versus Overlapped Commands
The CS260B can accept and buffer more than one command. It completes “sequential” commands
before starting on the next command in its
command queue. In contrast, it handles “overlapped”
commands by initiating the appropriate operation and then starting on the next command (if any)
while the previous overlapped operation is in progress.
The wavelength command is an example of an overlapped operation. It may take some time to
move the grating to a new wavelength, so the CS260B initiates the move operation and then starts
the next command (if it has received one).
The CS260B provides four methods to facilitate finding out when overlapped operations have
finished. Some of these methods are adapted from the IEEE488 standard. The simplest to use
(but not always best) is the
“*OPC?” query. The CS260B does not send a response to this
IEEE488-standard query until all of its pending operations are complete, and then it returns the
value 1. An application can send this query and wait until it receives a response; then it will know
that all pending operations are complete. For example:
•
Send wavelength command (e.g. gowave 585);
•
Send “*opc?” and wait for response; read response.
•
Read detector.
If an operation or a series of operations takes a long time to complete,
a customer’s application
may encounter a situation where its “query” mechanism times out before the CS260B finishes the
requested operations and responds to “*OPC?”. If increasing the application’s timeout is not an
option, or if the application simply cannot afford to halt while it waits for a response, there are other
approaches that allow the application to poll the CS260B.
The second
approach uses the “idle?” query. It returns the value “1” when all operations are
complete, and “0” when there is at least one operation pending. An application may periodically
send this query to poll the CS260B for operation complete. Pseudo-code for this approach would
be:
•
Send wavelength command;
•
Send “idle?” query.
•
If response is “0”, continue sending “idle?” query until response is “1”.
•
Read detector.
The third approach, as specified in IEEE488, is more complicated. The idea is to tell the CS260B
to set bit 0 in its Event Status Register (ESR) when all operations are complete. The application
can then periodically poll the ESR until bit 0 is set. Here is some pseudo-code for that:
•
Send wavelength command (this initiates the wavelength operation);
•
Send *OPC command (tells CS260B to set bit 0 when all currently pending operations
are finished);