Chapter 3
Operation
© National Instruments Corp.
3-7
GPIB-232CV User Manual
10
OPEN "COM1:9600,n,8,1" AS #1
'Assumes
'GPIB-232CV is
'at 9600 baud,
'no parity, 8
'data bits, 1
'stop bit.
20
PRINT #1,"pa1000,1000 os"
'Plot absolute to
'1000,1000 then
'output status.
30
LINE INPUT #1,RESPONSE$
'Get status
'response from
'plotter.
40
PRINT #1 "ci100";
'Draw circle
'with radius of
'100 units.
Notice that on line 20, the program outputs plotter commands to the serial
port to both draw a line and obtain status. Since neither a <CR> nor <LF>
was sent between these commands, the GPIB-232CV will keep the GPIB
plotter addressed to listen and will send all serial data received to the
plotter. Since the PRINT statement is not ended with a semicolon after the
double quotation mark, BASIC will automatically send a <CR> after the
last character in the ASCII string has been sent. Therefore, if the
GPIB-232CV is set up for <CR> termination, the GPIB-232CV would at
this time re-address the plotter to talk so that the status could be output.
Line 30 will input the status response from the plotter into a string variable
RESPONSE$
. Line 40 will then output the plotter command to draw a
circle to the GPIB-232CV. As soon as the GPIB-232CV receives the first
character in this string, it will re-address the plotter to listen before sending
these characters to the plotter. Notice that for this PRINT statement a
semicolon was included after the last double quotation mark so that a <CR>
will not be sent. Since information was not requested from the plotter, there
is no need to send a <CR> at the end of the string to address the plotter to
talk.
No-Swap Mode
In the last mode, no-swap, the GPIB-232CV will never re-address the GPIB
device after it has initially addressed it to be a Listener. This mode is useful
if your GPIB device is intended only to receive data. In the above example,
you could use the no-swap mode to talk to the plotter if you never need to
obtain status information from it.
Summary of Contents for GPIB-232CV
Page 55: ......