Appendix H
Sample Programs
© National Instruments Corp.
H-13
GPIB-232CT User Manual
Step 4. Communicate with Plotter
Before communicating with the plotter, send the initialization strings to the
GPIB-232CT. Next, send strings to the plotter (the GPIB-232CT does not
interpret these strings, but sends them straight to the plotter).
Remember to read status after you send a programming message to the
GPIB-232CT.
10 G232CT$="GPIB232CT"
20 CALL IBFIND(G232CT$,GPIB232CT%)
25 'Open GPIB-232CT
30 SDNAME$="PLOTTER"
40 CALL IBFIND(SDNAME$,PLOTTER%)
45 'Open PLOTTER
50 WRT$="stat c n" + CHR$(13)
60 CALL IBWRT(GPIB232CT%,WRT$)
65 'Enable continuous status reporting
70 RD$=SPACE$(25)
80 CALL IBRD(GPIB232CT%,RD$)
'Read up to
90 '25 bytes of status information
100 IF ASC(RD$) = CHR$(45) THEN GOTO 400
110 'If first character in RD$ is a minus sign
120 'then go to error ftn.
130 WRT$="spset 7"
135 'Change the serial port configuration
140 CALL IBWRT(GPIB232CT%,WRT$) 'to 7 data
145 'bits (plotter configuration)
150 CALL IBRD(GPIB232CT%,RD$) 'Read status info.
160 IF ASC(RD$) = CHR$(45) THEN GOTO 400
170 'If first character in RD$
180 'is a minus sign then go to error function.
190 WRT$="IN;SP1;IP2650,1325,7650,6325;"
200 'Initialize plotter, select pin 1, set
210 'scaling points
220 WRT$=WRT$ + "SC-100,100,-100,100;"
230 'Scale the plotting area
240 WRT$=WRT$ + "PA50,-40;CI30,30;"
250 'Plot absolute, circle=radius
260 '30 degrees, chordangle 30 degrees
270 CALL IBWRT(PLOTTER%,WRT$)
330 STOP
400 PRINT "An error occurred:"
410 PRINT "status, GPIB-error, serial-error,