'**************************************************************************** 'Module GPIB 'This module contains I/O subroutines for the GPIB board. ' 'Zachary Wolf '9/20/95 '**************************************************************************** 'Keep the GPIB file number in a common block COMMON SHARED /gpib/ gpibinP%, gpiboutP% SUB gpibclr '**************************************************************************** 'This subroutine clears the GPIB system. It is primarily used with the 'extender boxes. ' 'Zachary Wolf '11/29/95 '**************************************************************************** 'Send the abort command to clear the system PRINT #gpiboutP%, "ABORT" END SUB SUB gpibclrdev (addr$) '**************************************************************************** 'This subroutine clears a given GPIB device. ' 'Input: ' addr$, GPIB address (in a string) of the device to clear ' 'Zachary Wolf '2/21/96 '**************************************************************************** 'Perform the device clear PRINT #gpiboutP%, "CLEAR " + addr$ END SUB SUB gpibin (addr$, msg$) '**************************************************************************** 'This subroutine inputs a message string from a given GPIB device. ' 'Input: ' addr$, GPIB address (in a string) to get the message from ' msg$, the input message ' 'Zachary Wolf '2/21/96 '**************************************************************************** 'Input the message PRINT #gpiboutP%, "ENTER " + addr$ LINE INPUT #gpibinP%, msg$ END SUB SUB gpibinit (ieeein%, ieeeout%) '**************************************************************************** 'This subroutine opens the communication files to the GPIB board. It then 'clears and resets the board. ' 'Output: ' ieeein%, file for gpib input ' ieeeout%, file for gpib output ' 'Zack Wolf '2/22/94, 9/20/95 '**************************************************************************** 'Open a file to get data from the GPIB board. ieeein% = FREEFILE OPEN "\dev\ieeein" FOR INPUT AS #ieeein% 'Open a file to talk to the GPIB board. ieeeout% = FREEFILE OPEN "\dev\ieeeout" FOR OUTPUT AS #ieeeout% 'Reset the GPIB board. IOCTL #ieeeout%, "BREAK" PRINT #ieeeout%, "RESET" 'Enable no data available error detection. PRINT #ieeeout%, "FILL ERROR" 'Set the timeout period PRINT #ieeeout%, "TIME OUT 20" 'Display a message PRINT PRINT "Resetting the GPIB..." 'Display software information PRINT #ieeeout%, "HELLO" LINE INPUT #ieeein%, a$ PRINT a$ 'Display the status PRINT #ieeeout%, "STATUS" LINE INPUT #ieeein%, a$ PRINT a$ 'Save the file info gpibinP% = ieeein% gpiboutP% = ieeeout% END SUB SUB gpibout (addr$, cmd$) '**************************************************************************** 'This subroutine outputs a command string to a given GPIB device. ' 'Input: ' addr$, GPIB address (in a string) to send the command to ' cmd$, command to send to the device ' 'Zachary Wolf '2/21/96 '**************************************************************************** 'Send the command PRINT #gpiboutP%, "OUTPUT " + addr$ + ";" + cmd$ END SUB SUB gpibspoll (addr$, msg$) '**************************************************************************** 'This subroutine does a serial poll on a given GPIB device. ' 'Input: ' addr$, GPIB address (in a string) of the device to serial poll ' msg$, the message returned from the device ' 'Zachary Wolf '2/21/96 '**************************************************************************** 'Perform the serial poll PRINT #gpiboutP%, "SPOLL " + addr$ INPUT #gpibinP%, msg$ END SUB SUB gpibterm (termin$, termout$) '**************************************************************************** 'This subroutine sets the input and output GPIB terminators. ' 'Input: ' termin$, input terminator ' termout$, output terminator ' 'Zachary Wolf '2/21/96 '**************************************************************************** 'Set the GPIB terminators PRINT #gpiboutP%, "TERM IN " + termin$ PRINT #gpiboutP%, "TERM OUT " + termout$ END SUB