Appendix H
Sample Programs
© National Instruments Corp.
H-15
GPIB-232CT User Manual
Programming Steps
Step 1.
stat
Function
Send
stat c n
if you want status information returned after each
programming message. Next, use the
ibrd
function to read back status
after this string is sent, and after every other string sent to the GPIB-232CT
until continuous status is disabled.
Step 2. GPIB Initialization Functions
If there are GPIB functions on the GPIB-232CT you wish to change from
their default settings, send strings to the GPIB-232CT at this time. No
changes are necessary to communicate with this plotter.
Step 3. Serial Port Initialization Functions
Next, change any serial port characteristics, if necessary. If you have set up
the printer as previously described, no software initialization is necessary.
Step 4. Communicate with the Printer
Before communicating with the printer, send the initialization strings to the
GPIB-232CT. Next, send strings to the printer (the GPIB-232CT does not
interpret these strings, but sends them straight to the printer).
10 G232CT$="GPIB232CT"
20 CALL
IBFIND(G232CT$,GPIB232CT%)
25 'Open
GPIB-232CT
30 SDNAME$="PRINTER"
40 CALL
IBFIND(SDNAME$,PRINTER%) 'Open
PRINTER
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$)
90 'Read up to 25 bytes of status information.
100 IF ASC(RD$) <> CHR$(45) THEN GOTO 310
110 'If first characterin RD$ is a minus sign,