-
print "  Interface Bus Interactive Control (IBIC)                            "
print "  Example Program using NI-488.2 functions                            "
print ""
print "======================================================================"
print "  This sample program is for reference only. It can only be expected  "
print "  to function with a Fluke 45 Digital Multimeter.                     "
print ""
print "  The following program determines if a FLuke 45 multimeter is a      "
print "  listener on the GPIB.  If the Fluke 45 is a listener, a measurement "
print "  is read.                                                            " 
print ""
print "  After each command executes, the numeric value and mnemonic         "
print "  representation of the status word IBSTA is displayed.  The byte     "
print "  count IBCNT and the mnemonic definition of IBERR are also shown     "
print "  when appropriate.                                                   "
print ""
print "  The NI-488 function IBONL is called with a parameter value of zero  "
print "  to disable the hardware and software.  Execution of this program is "
print "  terminated after the call to the function IBONL.                    "
print ""
print "  The EXIT command is used to terminate this program.                 "
print "======================================================================"
print ""
print "  Select the NI-488.2 function mode using board index 0.              "
+
set 488.2 0
-
print "  Our board needs to be the Controller-In-Charge in order to find all "
print "  listeners on the GPIB.  To accomplish this, the function SendIFC is "
print "  called.                                                             "
+
SendIFC
-
print "  Create an array containing all valid GPIB primary addresses.  The   "
print "  constant NOADDR (hex ffff) signifies the end of the array.          "
+
FindLstn 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,0xffff 32
-
print "  Assume a listener was found at primary address 1.                   "
print "  Send the *IDN? command to the device that was found.  Your GPIB     "
print "  interface board is at address 0 by default.  The board does not     "
print "  respond to *IDN?, so skip it.                                       "
print "  The constant NLend instructs the function Send to append a linefeed "
print "  character with EOI asserted to the end of the message.              "
+
Send  1  "*IDN?"  NLend
-
print "  Read the name identification response returned from the device.     "
print "  The constant STOPend instructs the function Receive to terminate    "
print "  the read when END is detected.                                      "
print "  The returned string identifies the device at primary address 1.     "
print "  If the string is 'FLUKE ,45' then the Fluke 45 is a listener on     "
print "  the GPIB.                                                           "
+
Receive  1  10  STOPend
-
print "  Assuming that the Fluke 45 is at primary address 1,  reset the      "
print "  Fluke 45 using the functions DevClear and Send.                     "
print "  DevClear will send the GPIB Selected Device Clear (SDC) command     "
print "  message to the Fluke 45.                                            "
+
DevClear  1
-
print "  Use the function Send to send the IEEE-488.2 reset command (*RST)   "
print "  to the Fluke 45.                                                    "
+
Send  1  "*RST"  NLend
-
print "  Use the function Send to send device configuration commands to      "
print "  the Fluke 45.  Instruct the Fluke 45 to measure volts alternating   "
print "  current (VAC) using auto-ranging (AUTO), to wait for a trigger from "
print "  the GPIB interface board (TRIGGER 2), and to assert the IEEE-488    "
print "  Service Request line, SRQ, when the measurement has been completed  "
print "  and the Fluke 45 is ready to send the result (*SRE 16).             "
+
Send  1  "VAC; AUTO; TRIGGER 2; *SRE 16"  NLend
-
print "  Trigger the Fluke 45 by sending the trigger command (*TRG) and      "
print "  request a measurement by sending the command 'VAL1?'.               "
+
Send  1  "*TRG; VAL1?"  NLend
-
print "  Wait for the Fluke 45 to assert SRQ, meaning it is ready to send    "
print "  a measurement.  The timeout period by default is 10 seconds.        "
+
WaitSRQ  
-
print "  Read the serial poll status byte of the FLuke 45.                   "
+
ReadStatusByte  1
-
print "  Assume the Message Available Bit (bit 4) of the return status is    "
print "  set and read the Fluke 45 measurement.                              "
+
Receive  1  10  STOPend
-
print "  Call the ibonl function to disable the hardware and software.       "
+
ibonl  0
exit

