Table of Contents

Advertisement

Quick Links

National Instruments
Model GPIB-MAC User Manual
Part Number 320064-01
November 1985 Edition
National Instruments
12109 Technology Boulevard
Austin, Texas 78727
(512) 250-9119
© Copyright 1985 by National Instruments
All Rights Reserved

Advertisement

Table of Contents
loading

Summary of Contents for National Instruments GPIB-MAC

  • Page 1 National Instruments Model GPIB-MAC User Manual Part Number 320064-01 November 1985 Edition National Instruments 12109 Technology Boulevard Austin, Texas 78727 (512) 250-9119 © Copyright 1985 by National Instruments All Rights Reserved...
  • Page 2 LIMITED WARRANTY The GPIB-MAC is warranted against defects in materials and work- manship for a period of one year from date of shipment. National Instruments will repair or replace equipment which proves to be defective during the warranty period. This warranty includes parts and labor.
  • Page 3 FCC RADIO FREQUENCY INTERFERENCE COMPLIANCE This equipment generates, uses, and can radiate radio frequency energy and if not installed and used in accordance with the instruction manual, may cause interference to radio communica- tions. It has been tested using a shielded serial I/O cable and standard GPIB cable and found to comply within the limits for a Class A computing device pursuant to Subpart J of Part 15 of FCC Rules, which are designed to provide reasonable protection against...
  • Page 4 * Be sure the computing device is plugged into a grounded outlet and that the grounding has not been defeated with a cheater plug. * Replace the GPIB cable with Hewlett-Packard Model 10833 cable. If none of these measures resolves your interference problems, contact the manufacturer or write to the U.S.
  • Page 5 Preface Welcome to the family of National Instruments GPIB products and to the Model GPIB-MAC. The Model GPIB-MAC allows the GPIB to be controlled from a Macintosh personal computer. About the Manual The manual is designed for users who have some familiarity with the Macintosh personal computer, the GPIB, and test and meas- urement equipment.
  • Page 6 November 1985 © National Instruments Organization of the Manual gives brief introductions to the GPIB-MAC and the Section One - IEEE-488. contains the installation and configuration steps. Section Two - Section Three - explains how to program the GPIB-MAC. Section Four - gives a detailed description of each function.
  • Page 7: Table Of Contents

    Installation and Configuration SECTION TWO - Inspection Installation Voltage Requirements Configure the GPIB-MAC Rear Panel Switches Switches 1 and 2 - Factory Use Only Switch 3 - Word Length Switch 4 - Stop Bits Switches 5 and 6 - Parity Type...
  • Page 8 - Request Service/Set or Change Serial Poll Status Byte sic - Send Interface Clear spign - Ignore Serial Port Errors sre - Set or Clear Remote Enable stat - Return GPIB-MAC Status tmo - Change or Disable Time Limit wait - Wait for Selected Event wrt-WriteData*...
  • Page 9 November 1985 93 APPENDIX A - Multiline Interface Messages Status Information 97 APPENDIX B - Status Bits GPIB Error Codes Serial Port Error Codes APPENDIX C - Changing from 115 VAC to 230 VAC GPIB 107 APPENDIX D - Operation Types of Messages Talkers, Listeners, and Controllers System Controller and Active Controller...
  • Page 10 November 1985 Programming Steps Step stat Function Step 2 - Serial Port Functions Step 3 - GPIB Initialization Functions Step 4 - Communicate with rd and wrt Functions APPENDIX I - Serial Port Sample Program...
  • Page 11 10 2 Stop Bits 11 Configuration for Parity Types 12 Baud Rate Settings 14 GPIB-MAC with Serial Cable, Power Cable, and GPIB Cable APPENDIX C - Changing from 115 Volts AC to 230 Volts AC 105 GPIB-MAC with Cover Removed...
  • Page 12 November 1985 L I S T O F T A B L E S Introduction SECTION ONE - Front Panel LEDs Programming the GPIB-MAC SECTION THREE - 22 Serial Port Characteristics 22 GPIB Characteristics 23 I/O Functions 23 Bus Management Functions...
  • Page 13: Section One - Introduction

    November 1985 Section One - Introduction This section provides brief introductions to the GPIB-MAC and the IEEE-488. It also describes the physical, electrical, and environmental characteristics of the GPIB-MAC. Introduction to the GPIB-MAC The GPIB-MAC is a high performance GPIB-to-Macintosh interface.
  • Page 14: Environmental Specifications

    The GPIB-MAC is designed to operate in temperatures ranging from 10 to 40 degrees Celsius, and in humidity ranging from 10% to 95% non-condensing. The GPIB-MAC can be stored in temperatures ranging from 0 to 70 degrees Celsius. Physical Specifications The GPIB-MAC, shown in the following figure, is housed in a structural foam injection molded case.
  • Page 15: Quick Reference Chart

    November 1985 On the back panel of the GPIB-MAC is a reference chart that contains the information you need to configure the rear panel switches of the GPIB-MAC. More detailed configuration information is included in Section Two. The Model GPIB-MAC Front Panel The front panel of the GPIB-MAC is shown in the following figure.
  • Page 16: The Model Gpib-Mac Back Panel

    GPIB signal line SRQ* is asserted (low). The Model GPIB-MAC Back Panel. back panel of the GPIB-MAC is shown in the following figure. The power connector, 9-position configuration switch, g-pin D- subminiature connector, and GPIB (IEEE-488) port are shown.
  • Page 17: Back Panel Of The Model Gpib-Mac

    November 1985 Power GPIB (IEEE-488) Connector Port D-subminiature Configuration Connector Switch Back Panel of the Model GPIB-MAC SECTION ONE - INTRODUCTION...
  • Page 18: Mechanical Specifications

    88.4 mm (3.5 inches) Depth: 330.2 mm (13.0 inches) Weight: 5.25 pounds Electrical Specifications The GPIB-MAC is designed to operate under the following electrical specifications. Power: 115 volts AC or 230 volts AC; 50/60 Hz; 20 VA Typical Current: .09 amps AC...
  • Page 19: Section Two - Installation And Configuration

    November 1985 Section Two - Installation and Configuration Use this section to install and configure the GPIB-MAC. Then, read Sections Three and Four to learn about how to program the GPIB-MAC. Inspection Before you install the GPIB-MAC, inspect the shipping container and its contents for damage.
  • Page 20: Gpib-Mac Dip Switch

    November 1985 Configure the GPIB-MAC Rear Panel Switches Configure the GPIB-MAC by setting the switches of the g-pin, rear panel DIP switch. The following figure shows the switches labeled for factory use only, 7- or g-bit word length, one or two stop bits, odd/even or no parity, and baud rate.
  • Page 21: 7-Bit Word Length

    November 1985 Switch 3 - Word GPIB-MAC Configure the for a serial word length of 7 or 8 bits by setting switch 3. The off position indicates 7 bits, the on position indicates 8. 9 SECTION TWO: INSTALLATION AND CONFIGURATION...
  • Page 22 November 1985 Bits Switch 4 - StoD Configure the GPIB-MAC for a stop bit length of 1 or 2 bits by setting switch 4. The off position indicates 1 bit, the on position 1 Stop Bit Stop Bits 10 SECTION TWO: INSTALLATION AND CONFIGURATION...
  • Page 23 November 1985 Switches 5 and 6 - Paritv The GPIB-MAC can transmit and receive serial data using odd parity, even parity, or no parity. Configure the GPIB-MAC for the correct parity according to the following figure. Note that switch 5 indicates parity off. Switch 6 indicates parity odd or even.
  • Page 24 November 1985 Configure the GPIB-MAC for the appropriate baud rate by setting switches 7,8, and 9 according to the following figures. Switch Settings Baud Rate 2400 4800 12 SECTION TWO: INSTALLATION AND CONFIGURATION...
  • Page 25 November 1985 B a u d 9600 If you need more information on how the switches of the GPIB- MAC should be set, refer to Appendix G. SECTION TWO: INSTALLATION AND CONFIGURATION...
  • Page 26: Gpib-Mac With Serial Cable, Power Cable, And Gpib Cable

    You must connect three cables to operate the GPIB-MAC: the serial cable, the power cable, and the GPIB cable. The three cables all connect to the GPIB-MAC via the rear panel, as shown in the following figure. GPIB-MAC with Serial Cable, Power Cable, and GPIB Cable The power cord receptacle is located at the top left of the rear panel.
  • Page 27: Turn Power Switch To On

    After changing switch settings, turn the power switch off and back on for the change to take effect. Also, the GPIB address of the GPIB-MAC at power on is 0 with secondary addressing disabled. You can change these values after power-on using a programming message.
  • Page 28: Section Three - Programming The Gpib-Mac

    November 1985 Section Three - Programming the GPIB-MAC This section shows how to program the GPIB-MAC by using programming messages and data strings. It describes programming messages, their format, and how they areprocessed, along with the functions and function arguments that make up the programming messages.
  • Page 29: How Messages Are Processed

    How Messages are Processed The GPIB-MAC processes a programmin g message on a line-by- line basis. The GPIB-MAC buffers the entire message, interprets the function name and arguments, then executes the message.
  • Page 30: Function Argument Delimiters

    0 = false, off, or disable GPIB Address Each device on the GPIB has a GPIB address. The GPIB-MAC’s address is 0 at power on and may be changed using the caddr function. Refer to the manuals of your GPIB devices to learn their addresses.
  • Page 31: Numeric String Argument

    The function descriptions also explain that the GPIB-MAC “returns to you” certain information. This means that the GPIB-MAC sends information to you over the serial port. You then read this information from your serial port...
  • Page 32: Serial Port Error Handling

    GPIB Read and’write Termination Method (END and EOS) You program the GPIB-MAC to Talk in order to send data messages over the GPIB, and to Listen in order to receive data messages from the GPIB. The IEEE-488 specification defines two ways that GPIB Talkers and Listeners may identify the last byte of data messages: END and EOS.
  • Page 33: Default Settings

    November 1985 The GPIB-MAC always terminates GPlB rd operations on the END message. Using the eos and eot functions, you may change the other default GPIB read and write termination methods. Default Settings The following tables list power-on characteristics of the GPIB-MAC and the functions you can use to change those characteristics.
  • Page 34: November 1985

    GPIB-MAC EOS modes,eoschar Change/disable GPIB EOS termination mode EOT on/off Enable/disable END message on GPIBwrites Place the GPIB-MAC online/ offline RSC on/off Request or release System Control Change or disable time limit SECTION THREE - PROGRAMMING THE GPIEbMAC...
  • Page 35: Serial Poll Functions

    PARALLEL POLL Function Set or clear individual status IST on/off bit for use in GPlB-MAC response to Parallel Polls Parallel Poll Configure PPC values Parallel Poll Unconfigure PPU address list Request (conduct) a Parallel Poll SECTION THREE - PROGRAMMING THE GPIB-MAC...
  • Page 36: Serial Port Initialization Functions

    GPIB-MAC FUNCTIONS Function Become active controller CAC mode Change GPIB address of the CADDR address GPIB-MAC Clear specified device(s) CLR address list Send GPIB commands commands Echo characters received from ECHO on/off serial port SECTION THREE - PROGRAMMING THE GPIB-MAC...
  • Page 37: November 1985

    Set or clear remote enable STAT modes Return GPIB-MAC status Change or disable time limit TRG address list Trigger selected device(s) WAIT mask Wait for selected event write data WRT count,address list data XON modes Change serial port SECTION THREE - PROGRAMMING THE GPIB-MAC...
  • Page 38 November 1985 Section Four - Functions This section contains descriptions of functions which you use to program the GPIB-MAC. These functions are in alphabetical order and are formatted to provide you a handy reference. Points to Remember 1. The programming examples for each function description are in Microsoft BASIC version 2.0.
  • Page 39 November 1985 6. It is necessary for you to send only enough characters of the function name to distinguish it from other functions. Those characters are shown in boldface in the syntax portion of each function description. ‘7. I/O and bus management functions meet most of your needs. In the descriptions that follow, these frequently used functions are marked with an asterisk (*).
  • Page 40 GPIB-MAC is m the Active Controller and1 if the GPIB-MAC h the Active Controller. If call cat with an argument and the GPIB-MAC is not CIC, the GPIB-MAC records the ECIC error. The power-on Controller status of the GPIB-MAC is Idle Controller.
  • Page 41 November 1985 Examples: ‘Take control immediately. 1. PRINT#l,“cac 1” ‘Take control synchronously. 2. PRINT # 1 ,“cac 0” ‘Are we the active controller? 3. PRINT #l,“CAC” response: lcCRxLF> . ..yes...we’re CAC SECTION FOUR - FUNCTIONS...
  • Page 42 98, which are equivalent. If you specify a primary address without a secondary address, secondary addressing is disabled. If you call caddr without an argument, the GPIB-MAC returns to you its current GPIB address. The address assigned by this function remains in effect until you call caddr again, call onl, or you turn off the GPIB -MAC.
  • Page 43 November 1985 The power-on default is 0 with secondary addressing disabled. Examples: ‘Give GPIB-MAC a primary address ‘of 0 and a secondary address of 22. ‘Change GPIB-MAC primary 2. PRINT #l,“CADDR 1” ‘address to 1 and disable secondary ‘addressing. ‘Return current GPIB-MAC address.
  • Page 44 32, the talk address is 64, and the secondary address is or 98, which are equivalent. If you call clr with alist, the GPIB-MAC clears only the devices specified in alist (Selected Device Clear). If you call clr without alist, the GPIB-MAC clears all devices (Device Clear).
  • Page 45 November 1985 If this is the first function you call that requires GPIB controller capability, and you have not disabled System Controller capability with csc, the GPIB-MAC sends Interface Clear (IX) to make itself CIC. It also asserts Remote Enable.
  • Page 46 Refer to Example 2 to learn how to send non-printable characters. #count, the If you call without GPIB-MAC recognizes the end of the command string when it sees #count a <CR> or <LF>. is required only if the command string contains a <CR> or an (LF> character.
  • Page 47 If you specify #count and enter more than #count command bytes, the excess command bytes up to the If you call cmd and the GPIB-MAC is not CIC, the SECTION FOUR - FUNCTIONS...
  • Page 48 November 1985 If the GPIB-MAC is CIC but not Active Controller, it takes control and asserts ATN before sending the command bytes. It remains Active Controller afterward. Refer to Appendix A to convert hex values to ASCII characters. Examples: ‘Program device at address 11 to 1.
  • Page 49 [bool]<CR> You use echo when a terminal emulation program is run Purpose: on the Macintosh while connected to the GPIB-MAC and you wish to echo what you type on the screen. Remarks: If the argument boo1 is 1, characters received from the serial port are echoed back to the serial port If the argument boo1 is 0, characters are not echoed.
  • Page 50: Data Transfer Termination Methods

    Purpose: You use eos at the beginning of your program if you wish to use an eos mode when you transfer data to and from the GPIB. eos tells the GPIB-MAC when to stop reading information from the GPIB. eos also enables the GPIB-MAC to tell other devices that it is finished writing information to the GPIB.
  • Page 51 EOS character. If Methods X and B are chosen, a full Note that defining an EOS byte for the GPIB-MAC does not cause the GPIB-MAC to insert that byte into the data string when performing GPIB writes. To send the EOS...
  • Page 52 LINE INPUT #l,COUNT$ ‘of bytes actually read from GPIB PRINT ‘of bytes that were read from the ‘GPIB. ‘Tell GPIB-MAC on wrt, send 2. PRINT #l,“EOS X,13” ‘terminate when <CR> is ‘detected; compare 7 bits. ‘GPIB-MAC sends EOI with PRINT #l,“wrt #lO 5”...
  • Page 53 The assignment made by eot remains in effect until you call eot again, call onl, or you turn off the GPIB-MAC. The GPIB-MAC sends the END message by asserting the GPIB EOI signal during the last byte of a data transfer.
  • Page 54 November 1985 Examples: ‘Disable END termination. 1. PRINT #l,“eot 0” ‘Send END with last byte. 2. PRINT #l,“EOT 1” Write data to device at address 3. PRINT #l,“WRT 3” The EOI line is automatically PRINT # 1,” ABCDE” ‘asserted when the last byte (the letter E) is sent to tell the ‘Listeners it is the last byte of data.
  • Page 55 CSB,O if the GPIB-MAC is in Standby without shadow handshaking; handshaking; CAC if the GPIB-MAC is CIC but is not in Standby, i.e., it is the Active Controller; and COLE if the GPIB-MAC is not the CIC, i.e., is an IDLE Controller.
  • Page 56 EOS detection if the end-of- string character used by the talker is not known. If you call gts with an argument and the GPIB-MAC is not CIC, the GPIB-MAC records the ECIC error. Refer also to Examples: ‘GTS without shadow handshaking.
  • Page 57 The third string identifies the number of bytes of RAM in the GPIB-MAC. Example: PRINT # 1 ,“idhIAC” ‘Get system identification response: GPIB-MAC, Rev. A.OcCRxLF> (c)1985 National InstrumentscCR>cLF> 2K bytes RAMcCR>cLF> SECTION FOUR - FUNCTIONS...
  • Page 58 Parallel Poll function Syntax: ist [bool]&R> Purpose: You use ist when the GPIB-MAC participates in a parallel poll that is conducted by another device that is Active Controller. Remarks: If the argument boo1 is 1, the GPIB-MAC’s individual status bit is set to 1. If the argument is 0, the GPIB-MAC’s individual status bit is cleared.
  • Page 59 Since a device must usually be placed in remote program mode before it can be programmed from the GPIB, the GPIB-MAC automatically puts the device in remote program mode. You then use lot to return devices to local program mode.
  • Page 60 System Controller, the GPIB-MAC returns all devices to local mode by unasserting REN and asserting it again. If you call lot without and the GPIB- MAC is not System Controller, the GPIB-MAC records the ESAC error. Refer to Appendix B for more error information. Examples: ‘Put 3 devices in local mode.
  • Page 61 If you call without an argument, the GPIB-MAC returns the current status of the GPIB-MAC, which is 0 if the GPIB-MAC is offline and 1 if the GPIB-MAC is online. Placing the GPIB-MAC offline may be thought of as disconnecting its GPlB cable from the other GPIB devices.
  • Page 62: National Instruments

    November 1985 Examples: ‘Put the GPIB-MAC online and 1. PRINT #l,“onl 1” ‘restore its power-on settings. ‘Put the GPIB-MAC offline to 2. PRINT #l,“ONL 0” ‘prevent it from communicating ‘with the GPIB. SECTION FOUR - FUNCTIONS...
  • Page 63: 52 Sectionfour-Functions

    Controller capability. If you call pet with an argument and the GPIB- MAC is not CIC, it records the ECIC error. If you call pet without an argument, the GPIB-MAC records the EARG error. 52 SECTIONFOUR-FUNCTIONS...
  • Page 64 November 1985 Example: PRINT #l,“pct 7+18” ‘Pass control to device with ‘primary address 7 and ‘secondary address 18. 53 SECTIONFOUR-FUNCTIONS...
  • Page 65 November 1985 ppc - Parallel Poll Configure Parallel Poll function Syntax: ppc addr,ppr,s [addr,ppr,s] [addr,ppr,s]...cCR> You use ppc to configure specified devices to respond Purpose: to parallel polls in a certain manner. addr specifies the GPIB address of the device to be Remarks: enabled or disabled for parallel polls.
  • Page 66 (PPE) message for each addr specified. When addr is the address of the GPIB-MAC, the GPIB- MAC programs itself to respond to a parallel poll by setting its local poll enable (lpe) message to the value specified.
  • Page 67 November 1985 Parallel Poll Unconfigure Syntax: Purpose: You use if you are performing parallel polls and you wish to prevent certain devices from responding. addrs The argument is a list of which are Remarks: addrs are separated by commas or spaces. device addresses that specify the GPIB addresses of the device or devices to be disabled from parallel polls.
  • Page 68 IFC to make yourself CIC before making this call. Otherwise, the ECIC error will be posted. If the address of the GPIB-MAC is included in GPIB-MAC disables itself from responding to parallel polls.
  • Page 69 32, the talk address is 64, and the secondary address is 2 or 98, which are equivalent. The GPIB-MAC reads data from the GPIB until the specified byte count is reached, the GPIB END message is received with a data byte, the EOS byte is received, or a timeout occurs.
  • Page 70 GPIB, the GPIB-MAC returns the received GPIB data to you as follows. First, the GPIB-MAC returns to you all bytes it read from the GPIB. Next, it sends null bytes until the total number of bytes returned to you matches your requested count.
  • Page 71 Otherwise, the ECIC error will be posted. talker address, the GPIB-MAC assumes it will be addressed by the Controller, then proceeds. If you call rd without an argument, the GPIB-MAC records the EARG error. Refer also to tmo. Example: Read up to 10 bytes from the PRINT #l,“rd #lO 3”...
  • Page 72 Remarks: rpp causes the GPIB-MAC to conduct a parallel poll of previously configured devices by sending the IDY message (ATN and EOI both asserted) and reading the response from the GPIB data lines.
  • Page 73 November 1985 Example: PRINT #l,“ppc 13,1,0 15,3,O”+CHR$(13)+“rpp” ‘Configure 2 ‘devices for parallel polls and poll ‘them. response: (both devices responded positively) LINE INPUT #l,RESP$ ‘Get parallel poll response from ‘serial port buffer and assign it to ‘integer variable PPR%. ‘parallel polls. SECTION FOUR - FUNCTIONS...
  • Page 74 If you call rsc without an argument, the GPIB-MAC returns to you its System Controller status, which is 0 if GPIB-MAC is not currently System Controller or 1 if the GPIB-MAC is System Controller. As System Controller the GPIB-MAC can send the Inter- face Clear (IX) and Remote Enable @EN) messages to GPIB devices.
  • Page 75 Examples: ‘Enable GPIB-MAC to be system 1. PRINT #l,“rsc 1” ‘controller. ‘Disable system control. 2. PRINT #l,“rsc 0” What is the current system 3. PRINT #l,“rsc” ‘controller status? response: OcCR>cLF> (GPIB-MAC is not the System Controller) SECTION FOUR - FUNCTIONS...
  • Page 76 November 1985 rsp - Request (Conduct) a Serial Poll Serial Poll function rsp: Syntax: rsp if you You use wish to conduct a serial poll to obtain Purpose: device-specific status information from one or more devices. Remarks: argument is a list of addrs which are separated addrs are by commas or spaces.
  • Page 77 - 1, as the number of addresses you specify. If you call rsp and the GPIB-MAC is not CIC, it attempts to become CIC. If it cannot become CIC, it records the ECIC error. Refer to Appendix B for more information.
  • Page 78 November 1985 Example: PRINT #l,“rsp 1+28,5,9” ‘Poll 3 devices. response: (device 9 did not respondwithin the timeout period) Read responses from serial port ‘buffer. FOR I=0 to 2 ‘Store each serial poll response in LINE INPUT #l ,RESP$ ‘the array SPR%. IF SPR%(I) = -1 THEN GOSUB 1000 ‘1000 is an error ‘routine.
  • Page 79 Serial Poll function Syntax: Purpose: You use rsv if the GPIB-MAC is not GPIB Controller and you wish to request service from the Controller using the Service Request (SRQ) signal. The GPIB- MAC will provide a user defined status byte when the Controller serially polls it.
  • Page 80 CIC. When needed, sic is generally used at the beginning of a program to make the GPIB-MAC CIC and is used when a bus fault condition is suspected. The IFC signal resets only the GPIB interface functions of bus devices and not the internal device functions.
  • Page 81 November 1985 The GPIB-MAC records the ESAC error if you have disabled its System Controller capability with the rsc function. It records the EARG error if you specify a time outside the range BOO1 to 3600. Refer also to clr and to Appendix D.
  • Page 82 GPIB-MAC processes programming messages and data. This function tells the GPIB-MAC to ignore or not to ignore the occurrence of serial port errors. By default, the GPIB-MAC ignores serial port errors.
  • Page 83 November 1985 Examples: ‘Do not execute programming 1. PRINT #l,“spign 0” that ‘messages or process data ‘contain serial port errors. ‘Execute all programmh g messages 2. PFUNT #l ,“spign 1” ‘and send all data, even if serial port ‘errors occur. SECTION FOUR - FUNCTIONS...
  • Page 84 Use lot to return the device to local program mode. sre with If you call an argument and the GPIB-MAC is not System Controller, the GPIB-MAC records the ESAC error. If you call without an argument, the GPIB-MAC returns its current remote status: l=remote, O=local.
  • Page 85 November 1985 Examples: 1. PRINT #l,“SRE 1” ‘Set REN. 2. PRINT #l,“sre 0” SECTION FOUR - FUNCTIONS...
  • Page 86 [c] s&R> stat [c] n s&R> stat You use to obtain the status of the GPIB-MAC to Purpose: see if certain conditions are currently present. You use stat most often to see if the previous operation resulted in an error.
  • Page 87: Gpib Status Conditions

    The highest order bit of status, also called the sign bit, is set when the GPIB-MAC detects either a GPIB error or a serial port error. Consequently, when status is negative, an error condition exists, and when status is positive, no error condition exists.
  • Page 88: Gpib Error Conditions

    Value (n) NGER No GPIB error condition to report ECIC Command requires GPIB- MAC to be CIC ENOL Write detected no listeners EADR GPIB-MAC not addressed correctly EARG Invalid argument or arguments ESAC Command requires GPIB- EABO I/O operation aborted F-16...
  • Page 89: Serial Port Error Conditions

    Appendix B. In general, the GPIB-MAC updates the first three status variables at the end of each programming message. It updates the fourth, count, after a cmd, rd, or function The errors reported correspond to the previous programming message.
  • Page 90 Notice that when you send several programming messages to the GPIB-MAC, it buffers them and processes each one without any delay in between. However, if you enable continuous status reporting and check the status of each programming message before...
  • Page 91 5 0 R E M NSER<CRxLF>3<CRxLF> 3. The following list illustrates what appears on the screen when you are progr amming the GPIB-MAC from a terminal. Programming messages you enter are in normal type. GPIB- MAC responses are in bold. The statements in parentheses are comments.
  • Page 92 Syntax: tmo [timeio] [ ,timesp] <CR> Purpose: You use tmo at the beginning of your program to change the time limits in effect on the GPIB-MAC. The time limits prevent the GPIB-MAC from hanging indefinitely when an error situation prevents normal completion of an operation.
  • Page 93 If you want to change only the timeout value for serial polls, a comma must precede the serial poll timeout value. If you call tmo without an argument, the GPIB-MAC returns a numeric string representing the cuxmnt timeout settings. It records the EARG error if you specify a time value outside the range .OOOOl to 3600.
  • Page 94 If this is the fust function you call that requires GPIB controller capability, and you have not disabled System Controller capabiltity with rsc, the GPIB-MAC sends Interface Clear (IX) to make itself CIC. It also asserts Remote Enable. SECTION FOUR - FUNCTIONS...
  • Page 95 November 1985 If you passed control to some other GPIB device,control must be passed back to you or you must send IFC to make yourself CIC before making this call. Otherwise, the ECIC error will be posted. Example: ‘Trigger 3 devices. PRINT #l,“trg 2+10,4,5+7”...
  • Page 96 General Use function Syntax: wait mask<CR> wait Purpose: You use to monitor selected GPIB events and to delay any further GPIB-MAC activity until one of them occurs. mask Remarks: The argument is a numeric string which specifies the events to wait for. The numeric string represents a bit mask containing a subset of the same bit assignments as the status word described in the stat function.
  • Page 97: Wait Mask Values

    You should disable timeouts only when you are certain the selected event will occur; otherwise, the GPIB-MAC waits indefinitely for the event to occur. wait If you call without an argument, the GPIB-MAC records the EARG error.
  • Page 98 2. PRINT #l,“wait 4” ‘Wait indefinitely to become LACS. SPERR%=VAL(LINE INPUT #l,SPERR$) PRINT #l,“rd lo” ‘Now that GPIB-MAC is addressed to ‘listen, read 10 bytes from the GPIB. RESP$=INPUT$( lO,#l) ‘Input 10 bytes from serial port ‘buffer. LINE INPUT # 1 ,CNT!§ ‘Input number of valid bytes in CNT$.
  • Page 99 November 1985 wrt - Write Data * Syntax: wrt [#count][alist]<CR> Purpose: You use to send data over the GPIB. Remarks: The argument count is a numeric string preceded by a number sign (#). The string specifies a number between #count 1 and 65535 and must not contain a comma.
  • Page 100 Otherwise, the ECIC error will be posted. If you do not give an alist and the GPIB-MAC is not CIC, it assumes it will be addressed by the controller. If...
  • Page 101 November 1985 limit is 10 seconds unless you use tmo to change it. The GPIB-MAC also aborts the wrt and records the ENOL error if there are no addressed Listeners when it begins to send data. Refer also to tmo for timeout information, to...
  • Page 102 Serial Port function Syntax: xon [booltx][,boolrx]<CR> Purpose: You use at the beginning of your program to configure the GPIB-MAC to communicate over the serial port using the same XON/XOPP protocol as your Macintosh. booltx Remarks: The argument specifies whether to enable the booltx serial port.
  • Page 103 November 1985 The power-on default is that XON/XOPP for both cases is disabled. If you call xon without an argument, the GPIB-MAC returns to you the current settings. (l=protocol enabled, O=protocol disabled) Examples: ‘Enable GPIB-MAC XON/XOPP 1. PRINT #l,“XON 1,l”...
  • Page 104 November 1985 Appendix A Multiline Interface Messages The following tables are multiline interface messages (Sent and Received with ATN TRUE). APPENDIX A - MULTILINE INTERFACE MESSAGES...
  • Page 105 November 1985 Multiline Interface Messages 01 001 02 002 03 003 0 4 0 0 4 05 005 06 006 07 007 OA 012 OC 014 OD 015 > APPENDIX A - MULTILJNE INTERFACE MESSAGES...
  • Page 106 November 1985 Multiline Interface Messages MS A,PPE 40 100 41 101 61 141 MS A,PPE 62 142 MS A,PPE 42 102 43 103 63 143 MS A,PPE 44 104 64 144 MS A,PPE MS A,PPE 45 105 65 145 66 146 MS A,PPE 46 106 47 107...
  • Page 107 November 1985 Appendix B - Status Information This appendix describes the status and error information that the number preceding each description is the numeric value of that bit in the status word or of the error code. Status Bits following paragraphs describe the conditions represented by the bits in status.
  • Page 108 The REM bit specifies whether the GPIB-MAC is in remote state. The REM bit is set whenever the Remote Enable listen address has been sent either by the GPIB-MAC or by another Controller. The REM bit is cleared whenever REN...
  • Page 109 Talker. The TACS bit is set whenever the GPIB-MAC detects that its talk address (and secondary address, if enabled) has been sent either by the GPIB-MAC itself or by another Controller. The TACS bit is cleared whenever the GPIB-MAC detects the Untalk (UNT) command, a talk address other than its own, its own listen address, or Interface Clear (IX).
  • Page 110 The DTAS bit specifies whether the GPIB-MAC has detected a device trigger command. The DTAS bit is set whenever the GPIB-MAC as a Listener, detects the Group Execute Trigger (GET) command has been sent by another Controller. The DTAS bit is cleared in status at the start of any subsequent programming message.
  • Page 111 ECIC The GPIB-MAC records this error when you call a function that requires that the GPIB-MAC be CIC and it is not CIC. In cases when the GPIB-MAC should always be the Controller-In-Charge, the remedy is to be sure to call...
  • Page 112 November 1985 EADR 3 The GPIB-MAC records this error when it is not addressed to listen or to talk before read and write calls when it is not the Controller-In-Charge. The remedy is to be sure that the Controller addresses the GPIB-MAC to talk or listen before...
  • Page 113 GPIB-MAC discards that data byte and all subsequent data bytes. You may use the spign function to tell the GPIB-MAC to ignore all serial port errors, in which case the data bytes are sent even if they contain serial port errors.
  • Page 114 When this error occurs, one or more characters sent to the serial port have been lost. If this error occurs, check to see that the GPIB-MAC and your Macintosh are using the same serial port settings. The GPIB-MAC records this error when the GPIB-MAC’s internal serial port buffer overflows.
  • Page 115: Volts Ac

    Appendix C Changing from 115 Volts AC to 230 Volts AC This section shows you how to convert your GPIB-MAC from 115 Volts AC to 230 Volts AC. Turn the power switch to Off. This switch is located on the rear panel of the GPIB-MAC.
  • Page 116 Replace the screws you removed in Step 1. 6. Remove the fuse assembly. Replace the l/4 ampere fuse supplied with the GPIB-MAC with a l/8 ampere fuse. Re-insert the fuse assembly. APPENDIX C - CHANGING FROM 115 Volts AC TO 230 Volts AC...
  • Page 117: Appendix D Operation Of The Gpib

    November 1985 Appendix D Operation of the GPIB The GPIB is a link, or bus, or interface system through which interconnected electronic devices communicate. Hewlett-Packard invented the GPIB, which they call the HP-IB, to connect and control programmable instruments manufactured by them. Because of its high system data rate ceilings of from 250K bytes to 1M byte per second, the GPIB quickly became popular in other applications such as intercomputer communication and peripheral control.
  • Page 118: System Controller And Active Controller

    November 1985 Devices can be Talkers, Listeners, and/or Controllers. A digital multimeter, for example, is a Talker and may also be a Listener. A printer or plotter is usually only a Listener. A computer on the GPIB will often combine all three roles to manage the bus and communicate with other devices.
  • Page 119: Gpib Cable Connector

    November 1985 GPIB Signals The interface bus consists of 16 signal lines and 8 ground return or shield drain lines. The 16 signal lines are divided into three groups: * 8 datalines * 3 handshake lines * 5 interface management lines The following figure shows the arrangement of these signals on the GPIB Cable Connector APPENDIX D - OPERATION OF THE GPIB...
  • Page 120: Data Lines

    November 1985 Data Lines The eight data lines, DIOl through D108, carry both data and command messages. All commands and most data use the 7-bit ASCII or IS0 code set, in which case the 8th bit, D108, is unused or used for parity. Appendix A lists the GPIB command messages.
  • Page 121: Interface Management Lines

    November 1985 Interface Management Lines Five lines are used to manage the flow of information across the interface. ATN (attention) The Controller drives ATN true when it uses the data lines to send commands and false when it allows a Talker to send data messages. IFC (interface clear) The System Controller drives the IFC line to initialize the bus to become Controller-In-Charge.
  • Page 122: Linear Configuration Of Gpib Devices

    November 1985 M a c i n t o s h w i t h GPIB-MAC Linear Configuration of GPIB Devices APPENDIX D - OPERATION OF THE GPIB...
  • Page 123: Star Configuration Of Gpib Devices

    November 1985 Device B Device C Star Configuration of GPIB Devices APPENDIX D - OPERATION OF THE GPIB...
  • Page 124: Configuration Restrictions

    * No more than 15 devices connected to each bus, with at least two-thirds powered on. Bus extenders are available from National Instruments and other manufacturers for use when these limits must be exceeded APPENDIX D - OPERATION OF THE GPIB...
  • Page 125: Appendix E - Common Questions

    Use INPUT$ to read a data string from your GPIB-device. wish to read from the serial port. When reading status information from the GPIB-MAC, this is not always possible since the responses may vary in length from one call to the next. But when...
  • Page 126 VAL function to convert the string to a value and a leading Question I sent the prog ramming message “rsp lo” to the GPIB-MAC to serial poll device 10. Then, I used LINE INPUT# to read the response byte and got nothing but a carriage return and linefeed as a response.
  • Page 127: Appendix F - Parallel Polling

    November 1985 Appendix F Parallel Polling A Parallel Poll allows a GPIl3 controller to obtain information from several devices on the GPIB in one operation. The controller polls configured devices and reads back a single response byte that contains one bit of information from each device. From this information the controlIer can determine which devices need servicing.
  • Page 128: The Parallel Poll

    This might be used in the case where the GPIB- MAC is not the system controller and the system controller does not have the capability to do the configuration. Since the GPIB-MAC cannot be the controller, the GPIB controller in your system must configure the GPIB-MAC in order to parallel poll it.
  • Page 129: Disabling Parallel Poll Response

    Example A system has three line printers, two tape drives, one card reader, and one PC on a system. The PC uses a GPIB-MAC to communicate on the GPIB. All other devices are GPIB devices. The PC is designated to be active controller, and all other devices recognize this.
  • Page 130 November 1985 respond positively on DIO line 4 (which sets bit 3 of the response byte) when free by sending the configuration byte 01100011. (The S bit is set to 0, the value of bits O-2 is 3.) PPC 6,4,0 When a parallel poll is conducted one of two things will happen.
  • Page 131 Appendix G Setting Switches This appendix explains how to set the switches on the back panel of the GPIB-MAC. You may change the serial port characteristics of the Macintosh from within BASIC or other programming languages. The default characteristics of the Macintosh modem port are as...
  • Page 132: Appendix G - Setting Switches

    November 1985 then set the switches on the GPIB-MAC as follows: Remember, whatever serial port characteristics you decide to use, you must set up both your Macintosh and your GPIB-MAC to the exact same characteristics. APPENDIX G - SETTING SWITCHES...
  • Page 133: Appendix H - Sample Program

    Communicate with the device using the rd and step 4 functions, and check status if you requested it. After you initialize the GPIB-MAC, the rd and wrt functions may be the only functions you will need. Using an HP 7475A Plotter with a Macintosh This example shows how to write a program on the Macintosh using Microsoft BASIC to draw a circle using an HP 7475A Plotter.
  • Page 134 Set the back Dane1 switches on the Then, connect the serial cable to the serial port of your Macintosh and to the GPIB-MAC. Connect the GPIB cable to your device and the GPIB-MAC. Turn the power switch of the GPIB-MAC to On.
  • Page 135 November 1985 Send serial port initialization programming messages, if necessary. You can skip this for this example. Send GPIB initialization programming messages, if necessary. Again, you can skip this for this example. Communicate with the device using wrt programming messages, and reading back status after each.
  • Page 136 November 1985 status: LINE INPUT # 1 ,gpiberr$ LINE INPUT # 1 ,sperr$ LINE INPUT # 1 ,cnt$ if stat% < 0 GOSUB error error REM Place your code to handle errors here. STOP APPENDIX H - SAh4PLE PROGRAM...
  • Page 137 :bk=O; Purpose: This program is designed to send a text file containing commands and data to the GPIB-MAC. The program was compiled with Manx Aztec C-68K 106.F. The data file is read into memory once, then sent to the serial driver in a loop.
  • Page 138 November 1985 initialize Fonts */ Initialize TextEdit * main */ short refIn, ref0ut; short parity, stopbits, databits, baud: char c; int rc; = '\OZl'; APPENDIX I - SERIAL PORT SAMPLE PROGRAM...
  • Page 139 November 1985 flgs.xOff = '\023'; = hwOverrunErr baud = baud57600; baud = baud19200; parity = noParity; parity parity char *str; int rc; short refIn, refOut; char *s; short refNum; int rc; register long pause; long logEOF; static SFTypeList typeList = {'TEXT'); static Point where = { 100,70);...
  • Page 140 November 1985 continue; FSOpen( reply.fName, reply.vRefNum, &refNum)) continue; get end of file l / GetEOF( refNum, &logEOF)) continue: s = NewPtr( logEOF); continue: FSRead( refNum, blogEOF, s)) continue; FSClose( refNum); release buffer l / OL, 1, typelist. OL, breply); char *s; long logEOF;...
  • Page 141 November 1985 short refin; long count, pause; char *text: if (count > 0) text = NewPtr( count): text == NULL){ return: return; pause;) char *txt; register long pause: APPENDIX I - SERIAL PORT SAMPLE PROGRAM...
  • Page 142 Product User Comment Form National Instruments encourages you to give us your comments on the clarity and accuracy of the documentation supplied with its products. This information helps us continue providing high quality products to meet your needs. Did you find deficiencies ? Please comment on the completeness, clarity, and organization.

Table of Contents