Example 4: End-Of-String Mode - National Instruments NI-488.2M Software Reference Manual

For os/2
Hide thumbs Also See for NI-488.2M:
Table of Contents

Advertisement

Application Examples

Example 4: End-of-String Mode

This example illustrates how to use the end-of-string modes to detect that the
GPIB device has finished sending data.
A journalist is using a GPIB scanner to scan some pictures into his personal
computer for a news story. A GPIB cable runs between the scanner and the
computer. He is using an application written by an intern in the department who
has read the instruction manual provided by the scanner manufacturer and is
familiar with its programming requirements. The following steps correspond to
the program flowchart in Figure 2-4.
1.
The application initializes the GPIB by bringing the interface board in the
computer online.
2.
The application sends a GPIB clear message to the scanner, initializing it to
its power-on defaults.
3.
The scanner needs to see a delimiter indicating the end of a command. In
this case, the scanner expects the commands to be terminated with
<CR><LF> (carriage return, \r, and linefeed, \n). The application sets its
end-of-string (EOS) byte to <LF>. The linefeed code indicates to the
scanner that there is no more data coming, and is called the end-of-string
byte. It flags an end-of-string condition for this particular GPIB scanner.
The same effect could be accomplished by asserting the EOI line when the
command is sent.
4.
With the exception of the scan resolution, all the default settings are
appropriate for the task at hand. The application changes the scan resolution
by writing the appropriate command to the scanner.
5.
The scanner sends back information describing the status of the change
resolution command. This is a string of bytes terminated by the
end-of-string character to tell the application it is done changing the
resolution.
6.
The application starts the scan by writing the scan command to the scanner.
7.
The application reads the scan data into the computer.
8.
As a cleanup step before exiting, the application returns the interface board
back to its original state by taking it offline.
NI-488.2M SRM for OS/2
2-8
© National Instruments Corp.
Chapter 2

Advertisement

Table of Contents
loading

Table of Contents