Application Examples Chapter 2
NI-488.2 User Manual for Windows 2-10 © National Instruments Corp.
Example 5: Service RequestsThis example illustrates how an application communicates with a GPIB device that uses
the GPIB service request (SRQ) line to indicate that it needs attention.
A graphic arts designer is transferring digital images stored on her computer to a roll of
color film, using a GPIB digital film recorder. A GPIB cable connects the GPIB port on
the film recorder to the IEEE 488.2 interface board installed in her computer. She has
installed the NI-488.2 software on the host computer and is familiar with the
programming instructions for the film recorder, as described in the film recorder's user
manual. She places a fresh roll of film in the camera and launches a simple application
she has written using high-level GPIB commands. With the aid of the application, she
records a few images on film. The following steps correspond to the program flowchart
in Figure 2-5.
1. The application initializes the GPIB by bringing the interface board in the computer
online.
2. The application brings the film recorder to a ready state by issuing a device clear
instruction. The film recorder is now set up for operation using its default values.
(The graphic arts designer has previously established that the default values for the
film recorder are appropriate for the type of film she is using.)
3. The application advances the new roll of film into position so the first image can be
exposed on the first frame of film. This is done by sending the appropriate
instructions as described in the film recorder programming guide.
4. The application waits for the film recorder to signify that it is done loading the film,
by waiting for RQS (request for service). The film recorder asserts the GPIB SRQ
line when it has finished loading the film.
5. As soon as the film recorder asserts the GPIB SRQ line, the application’s wait for the
RQS event completes. The application conducts a serial poll by sending a special
command message to the film recorder that directs it to return a response in the form
of a serial poll status byte. This byte contains information indicating what kind of
service the film recorder is requesting or what condition it is flagging. In this
example, it indicates the completion of a command.
6. A color image transfers to the digital film recorder in three consecutive passes–one
pass each for the red, green and blue components of the image. Sub-steps 6a, 6b,
and 6c are repeated for each of the passes:
6a. The application sends a command to the film recorder directing it to accept data
to create a single pass image. The film recorder asserts the SRQ line as soon as
a pass is completed.
6b. The application waits for RQS.