Page 3
The reader should consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it.
Page 4
Classification requirements are the same for the Federal Communications Commission (FCC) and the Canadian Department of Communications (DOC). Changes or modifications not expressly approved by National Instruments could void the user’s authority to operate the equipment under the FCC Rules.
Page 5
interference to radio or television reception, which can be determined by turning the equipment off and on, the user is encouraged to try to correct the interference by one or more of the following measures: • Reorient or relocate the receiving antenna. •...
Page 7
Serial Port Functions..................4-9 General Use Functions ..................4-9 Alphabetical List of S Mode Functions................. 4-9 Chapter 5 S Mode Functions cac..........................5-2 caddr ..........................5-4 clr........................... 5-6 cmd ..........................5-7 conf ..........................5-9 echo..........................5-11 eos..........................5-12 GPIB-232/485CT-A User Manual viii www.ni.com...
Page 9
Contents Serial Port Transmission....................6-7 Operation of the GPIB-232/485CT-A as a GPIB Device ..........6-7 Serial Poll Responses ..................6-7 Service Request Conditions ................6-8 Parallel Polls ....................6-8 Take Control (TCT) ..................6-9 Group Execute Trigger (GET) ................ 6-9 Go To Local (GTL)..................
Page 11
Sample Switch Settings for an IBM PC and Serial Printer....I-10 Tables Table 1-1. LED Descriptions.................. 1-4 Table 3-1. National Instruments Null-Modem Serial Cables......... 3-2 Table 3-2. S Mode Switch Settings for Serial Port Baud Rate....... 3-4 Table 3-3. S Mode Switch Settings for Data Formatting Characteristics ....3-5 Table 3-4.
Page 12
Data Transfer Termination Methods in G Mode........7-4 Table 7-2. SRQ Mask Bits in G Mode..............7-11 Table 7-3. G Mode GPIB-232/485CT-A Conditions Returned by stat ....7-14 Table 7-4. G Mode GPIB Error Conditions Returned by stat ........7-15 Table 7-5. Serial Port Error Conditions Returned by stat........7-15 Table A-1.
About This Manual The GPIB-232/485CT-A User Manual describes the features, functions, and operation of the GPIB-232CT-A and GPIB-485CT-A. This manual assumes that you have a general knowledge of RS-232 or RS-485 serial communications and the GPIB. Conventions The following conventions appear in this manual: This icon denotes a note, which alerts you to important information.
Receivers for Use in Balanced Digital Multipoint Systems • EIA/RS-422-A, Electrical Characteristics of Balanced Voltage Digital Interface Circuits • ANSI/IEEE Standard 488.1-1987, IEEE Standard Digital Interface for Programmable Instrumentation • ANSI/IEEE Standard 488.2-1992, IEEE Standard Codes, Formats, Protocols, and Common Commands GPIB-232/485CT-A User Manual www.ni.com...
Hardware Overview This chapter lists what you need to get started and optional equipment you can order, and briefly describes the GPIB-232/485CT-A. What You Need to Get Started Before you install your GPIB hardware, make sure you have all of the...
Chapter 1 Hardware Overview One of the following shielded cables, compatible with IBM PC, which you can purchase from National Instruments: – RS-232 DTE-to-DTE cable (1, 2, or 4 m) for the GPIB-232CT-A – RS-485 null-modem cable (1, 2, or 4 m) for the GPIB-485CT-A...
Talker/Listener/Controller functionality. AC Version Front Panel The power switch, fuse holder, and power cord receptacle are located on the GPIB-232/485CT-A front panel, on the AC version only. Figure 1-1 shows the front panel of the AC version. FUSE Figure 1-1. The AC Version Front Panel...
Chapter 1 Hardware Overview The LEDs show the current status of the GPIB-232/485CT-A at all times. Table 1-1 describes each LED. Table 1-1. LED Descriptions Indication POWER Indicates that power to the unit has been applied and the ON/OFF switch is in the ON position.
RS-232 connector and the signals supported. For more information on the RS-232 signals refer to Appendix D, Interfacing to an RS-232 Device. No Connection No Connection No Connection Figure 1-6. The RS-232 Connector and Signal Designations GPIB-232/485CT-A User Manual www.ni.com...
GND (Twisted Pair with NRFD*) NDAC* GND (Twisted Pair with NDAC*) IFC* GND (Twisted Pair with IFC*) SRQ* GND (Twisted Pair with SRQ*) ATN* GND (Twisted Pair with ATN*) SIGNAL GROUND SHIELD Figure 1-8. The GPIB Connector and Signal Designations GPIB-232/485CT-A User Manual www.ni.com...
Choosing Between S Mode and G Mode The GPIB-232/485CT-A can be connected to a serial device and one or more GPIB devices. The way you use the serial device in your system setup determines which mode of operation you should use. If the serial device is the Controller, you should use S mode.
GPIB-232/485CT-A in S mode. Operating in G Mode The GPIB-232/485CT-A should be configured to operate in G mode if your serial device acts only as a Talker and/or Listener while a GPIB device manages the system, sending and receiving data to and from the serial device.
RAM buffer determines how much serial data the GPIB-232/485CT-A can accept before the buffer is completely full. When its RAM buffer is nearly full, the GPIB-232/485CT-A can handshake with the serial host to stop data transmission. When the buffer is almost empty, the GPIB-232/485CT-A can again handshake with the serial host to start data transmission.
RTS+ and RTS– on the GPIB-485CT-A) and Clear to Send (CTS on the GPIB-232CT-A, CTS+ and CTS– on the GPIB-485CT-A) signal lines. When the GPIB-232/485CT-A is ready to accept serial data, it asserts the RTS line(s). RTS remains asserted until the GPIB-232/485CT-A data buffer is almost full.
Page 27
Because the binary data could contain any binary sequence, including decimal 19 (<Ctrl-S>) or decimal 17 (<Ctrl-Q>), the GPIB-232/485CT-A would not be able to distinguish between data values or handshake control codes. If XON/XOFF software handshaking were enabled in this case, the GPIB-232/485CT-A would handshake erratically.
This chapter contains detailed instructions for connecting and configuring your GPIB-232/485CT-A. Check the Hardware Configuration The AC versions of the GPIB-232/485CT-A are shipped with a 100–120 V or 220–240 V internal power supply. The DC versions of the GPIB-232/485CT-A are shipped with a 100–120 V or 220–240 V, wall-mount or desktop power supply.
GPIB cables, and follow all IEEE 488 cabling restrictions. If you have an AC version, connect the power cord to the power receptacle on the front panel of the GPIB-232/485CT-A, then plug the supply into an AC outlet of the correct voltage.
Installing and Configuring Your Controller If you have a DC version, connect the DC power plug of the DC power supply to the power jack on the serial end of the GPIB-232/485CT-A, then plug the supply into an AC outlet of the correct voltage.
OFF, which indicates that parity is disabled. Switch 6 is OFF, indicating 1 stop bit/character. Switch 7 is OFF, indicating that the GPIB-232/485CT-A is using 7 bits per character for serial data transfers. Tables 3-2 and 3-3 show the possible configurations for the baud rate and data format switches when you are using S mode and what each configuration indicates.
If you want to change the configuration on that side, do so before attempting to communicate with the GPIB-232/485CT-A. Then set the configuration switch on the GPIB-232/485CT-A to match your serial port characteristics. IBM PC or Compatibles...
9600 baud and 8 data bits from within Quick BASIC, place the following statement at the beginning of your application program: OPEN "COM1:9600,,8," AS #1 Then set the switches on the GPIB-232/485CT-A as shown in Figure 3-3. S MODE DATA FORMAT...
G mode. Choosing GPIB Addresses for G Mode When you use the GPIB-232/485CT-A in G mode, switches 1 through 5 set the primary GPIB address of the GPIB-232/485CT-A. The primary address plus one is the GPIB address of the serial device connected to the GPIB-232/485CT-A.
Installing and Configuring Your Controller shows the switch settings for the first (primary) GPIB address and the corresponding serial device address. Table 3-4. GPIB Address Switch Settings for G Mode Switches GPIB-232/ Serial 485CT-A Device Address Address GPIB-232/485CT-A User Manual www.ni.com...
S mode functions. Choosing Your S Mode Programming Method When using the GPIB-232/485CT-A in S mode, you can either use the S mode functions listed in the manual, or you can use the high-level NI-488.2 software for the GPIB-232/485CT-A. If you want to use the...
The programming examples for each function description are in Microsoft QuickBASIC Version 4.5. Although the examples in this manual are written in BASIC, you can program the GPIB-232/485CT-A using any programming language that has access to a serial port. •...
PRINT #1,"clr 3,4" This programming message contains the function name and the arguments . It tells the GPIB-232/485CT-A to clear the devices at GPIB addresses 3 and 4. is the BASIC command to send PRINT #1 characters to the serial port after the serial port has been opened with the statement.
GPIB Address One argument used with most functions is the GPIB address. Each device on the GPIB has a GPIB address. The GPIB-232/485CT-A address is 0 at power on, but you can change it using the function. Refer to the caddr manuals that came with your GPIB devices to learn their addresses.
When a function requires a list of one or more GPIB addresses, the maximum number of addresses that you can specify is 14. If you specify more than 14 addresses, the GPIB-232/485CT-A records the EARG error. This limit exists because the IEEE 488 specification allows no more than 15 GPIB devices to coexist on any GPIB.
S Mode Default Settings and Related Functions Tables 4-1 and 4-2 list power-on characteristics of the GPIB-232/485CT-A in S mode and the functions you can use to change those characteristics. Table 4-1. S Mode Serial Port Characteristics...
0.1 s List of S Mode Functions by Group The GPIB-232/485CT-A S mode functions are divided into three main groups: GPIB functions, serial port functions, and general use functions. For more information about the S mode functions, refer to the alphabetical...
Page 44
GPIB. Use them when the I/O and high-level bus management functions do not meet the needs of your GPIB device. • • • • lines • • • • Parallel Poll Functions—conduct and respond to GPIB parallel polls. • • • • GPIB-232/485CT-A User Manual www.ni.com...
Page 46
Table 4-3. Alphabetical List of S Mode Functions (Continued) Function Purpose Identify system set/clear Set or clear individual status bit for use in GPIB-232/485CT-A response to parallel polls Determine state of GPIB control lines lines address list Check for listening devices...
S Mode Functions This chapter contains descriptions of the S mode functions you can use to program the GPIB-232/485CT-A. These functions are in alphabetical order for easy reference. The I/O and high-level bus management functions are the most frequently used and should meet most of your needs.
If you call without an argument, the GPIB-232/485CT-A returns the current Controller status. The Controller status is 0 if the GPIB-232/485CT-A is not the Active Controller and 1 if the GPIB-232/485CT-A is the Active Controller. The GPIB-232/485CT-A must be CIC when you call with an argument.
If you specify a primary address without a secondary address, secondary addressing is disabled. If you call without an argument, the GPIB-232/485CT-A returns its current GPIB caddr address. The address assigned by this function remains in effect until you call...
GPIB addresses you want to clear. If you call with , the GPIB-232/485CT-A clears only the devices specified in alist (Selected Device Clear). If you call without , the GPIB-232/485CT-A alist alist clears all devices (Device Clear).
Page 55
If one of the errors described above occurs, the count might be less than expected. If an error occurs and the GPIB-232/485CT-A is unable to transmit the entire command string, the GPIB-232/485CT-A reads in and discards the remaining bytes of the command string.
Page 56
GPIB-232/485CT-A should accept. If the PP2 is 0, value the GPIB circuitry of the GPIB-232/485CT-A uses the IEEE 488 Parallel Poll (PP) interface function subset PP1 (remote configuration from an external Controller). If the PP2 value 1, the GPIB-232/485CT-A uses PP subset PP2 (local configuration via the functions).
Page 57
Chapter 5 S Mode Functions — conf Example 2 PRINT #1 "conf 0" 'Return the current setting for 'the PP2 option. response: 1<CR><LF> (PP2 mode selected) GPIB-232/485CT-A User Manual 5-10 www.ni.com...
Syntax <CR> echo [bool] Purpose You can use when a terminal is connected to the GPIB-232/485CT-A and you want echo everything you type to display on the terminal screen. Remarks If the argument is 1, characters received from the serial port are echoed back to the serial bool port.
GPIB. tells the GPIB-232/485CT-A when to stop reading information from the GPIB. also enables the GPIB-232/485CT-A to tell other devices that it is finished writing information to the GPIB. defines a specific character, end-of-string (EOS), to be recognized as a string terminator.
Page 60
Defining an EOS byte for the GPIB-232/485CT-A does not cause the GPIB-232/485CT-A to insert that byte into the data string when performing GPIB writes. To send the EOS byte, you must include it in the data string that you send following the programming message.
Page 61
'Send EOI* with <CR> on wrt; do not 'terminate when <CR> is detected 'on rd; compare 7 bits. PRINT #1,"wrt #10 5"+CHR$(10)+"012345678" 'GPIB-232/485CT-A sends EOI* with <CR> '(CHR$(13)) to tell Listeners that this 'is the last byte of data. Example 3 PRINT #1,"eos"...
Page 62
0, END is not sent. The power-on bool default is 1. The GPIB-232/485CT-A sends the END message by asserting the GPIB EOI* signal during the last byte of a data transfer. is used primarily to send variable length data.
Page 63
'asserted when the last byte (the letter 'E) is sent to tell the Listeners it is 'the last byte of data. Example 3 PRINT #1,"eot" 'What is the current EOT setting? response: 1<CR><LF> (END termination is currently enabled) GPIB-232/485CT-A User Manual 5-16 www.ni.com...
Page 64
GPIB-232/485CT-A to go to the Controller Standby state and to unassert the ATN* signal if it is initially the Active Controller. If you enable shadow handshaking, the GPIB-232/485CT-A participates in the data handshake as an Acceptor without actually reading the data.
Page 65
GPIB-232/485CT-A is in Standby with shadow handshaking CSB,1 • if the GPIB-232/485CT-A is CIC but is not in Standby—that is, it is the Active Controller • if the GPIB-232/485CT-A is not the CIC—that is, if it is an Idle Controller...
Page 66
The second string is a copyright notice. The third string identifies the number of bytes of RAM in the GPIB-232/485CT-A. The following example shows the current identification string at the time of this printing. The general format will be as shown;...
Page 67
GPIB-232/485CT-A participates in a parallel poll that is conducted by another device that is Active Controller. Remarks If the argument is 1, the GPIB-232/485CT-A’s individual status bit is set to 1. If the bool argument is 0, the GPIB-232/485CT-A’s individual status bit is cleared. The power-on bool default is 0.
Page 69
255 (hex FF) can be used as a secondary addr address. When this special value is used, the GPIB-232/485CT-A checks all of the secondary addresses for the specified primary address. If this is the first function you call that requires GPIB Controller capability, and you have not...
Page 70
IFC* to make yourself CIC before making this call. Otherwise, the ECIC error is posted. If only the special value of 255 (hex FF) is entered as a parameter, the GPIB-232/485CT-A configures itself for local program mode by pulsing its internal rtl (return to local) message.
Page 71
Status and Error Message Information. Example 1 PRINT #1,"loc 6+22,4+23,7" 'Put 3 devices in local mode. Example 2 PRINT #1,"LOC" 'Put all devices in local mode. Example 3 PRINT #1,"LOC 255" 'Put the GPIB-232/485CT-A in local 'program mode. GPIB-232/485CT-A User Manual 5-24 www.ni.com...
Page 72
GPIB and restores all settings to their power-on values. If you call without an argument, the GPIB-232/485CT-A returns the current state, which is 0 if the GPIB-232/485CT-A is offline and 1 if the GPIB-232/485CT-A is online. See Also S Mode Default Settings and Related Functions...
Page 73
CIC authority from the GPIB-232/485CT-A to the device specified by . The addr GPIB-232/485CT-A automatically goes to Idle Controller State. It is assumed that the target device has Controller capability. If you call with an argument and the GPIB-232/485CT-A is not CIC, it records the ECIC error.
Page 74
255 (hex FF), the addr addr GPIB-232/485CT-A configures itself for parallel polls. To do this, the GPIB-232/485CT-A must be using IEEE 488 Parallel Poll (PP) interface function subset PP2. You can do this by setting the PP2 option using the function.
Page 75
Chapter 5 S Mode Functions — ppc GPIB-232/485CT-A records the ECAP error. The GPIB-232/485CT-A does not require GPIB Controller capability to configure itself for parallel polls. See Also , and Appendix H, Parallel Polling. conf Example 1 PRINT #1,"PPC 18+23,8,0 23+10,7,1"...
Page 76
IFC* to make yourself CIC before making this call. Otherwise, the ECIC error is posted. If only is specified and it has the special value of 255 (hex FF), the GPIB-232/485CT-A addr disables itself from responding to parallel polls. To do this, the GPIB-232/485CT-A must be using IEEE 488 Parallel Poll (PP) interface function subset PP2.
Page 77
Chapter 5 S Mode Functions — ppu Example 2 PRINT #1,"PPU" 'Send the PPU command to all devices. Example 3 PRINT #1,"PPU 255" 'Disable the GPIB-232/485CT-A from 'responding to parallel polls. GPIB-232/485CT-A User Manual 5-30 www.ni.com...
Page 78
Because you might not know the number of bytes actually read from the GPIB, the GPIB-232/485CT-A returns the received GPIB data to you in the following manner. First, the GPIB-232/485CT-A returns all bytes it read from the GPIB. Next, if the number of bytes read is less than...
Page 79
GPIB-232/485CT-A assumes that it has already addr been addressed to listen by the Controller. If the GPIB-232/485CT-A is the Controller, and did not address itself to listen before calling , the EADR error is recorded and no data bytes are transferred.
Page 80
IDY* (Identify) message (ATN* and EOI* both asserted) and reading the response from the GPIB data lines. The GPIB-232/485CT-A pulses the IDY* message for greater than or equal to 2 microseconds and expects valid responses within that time. It remains Active Controller after pulsing the IDY* message.
Page 81
If you call without an argument, the GPIB-232/485CT-A returns its System Controller status, which is 0 if the GPIB-232/485CT-A is not currently System Controller or 1 if the GPIB-232/485CT-A is System Controller. As System Controller the GPIB-232/485CT-A can send the Interface Clear (IFC*) and Remote Enable (REN*) messages to GPIB devices.
Page 83
<CR> and <LF>. If a device does not respond in the timeout period, the GPIB-232/485CT-A returns the string –1 and records the EABO error. The time limit is set to 1/10 second unless you called to change it.
Page 85
GPIB-232/485CT-A serial poll response byte. The serial poll response byte is the status byte the GPIB-232/485CT-A provides when serial polled by another device that is CIC. If bit 6 (hex 40 or RQS bit) is also set, the GPIB-232/485CT-A requests service by asserting the SRQ* line.
Page 86
To determine the effect of these messages, consult the device documentation. The GPIB-232/485CT-A records the ESAC error if you have disabled its System Controller capability with the function. It records the EARG error if you specify a time outside the range .0001 to 3600.
Page 87
Chapter 5 S Mode Functions — sic Example 1 PRINT #1,"sic" 'Send interface clear for 500 'microseconds. Example 2 PRINT #1,"SIC .01" 'Send interface clear for 10 'milliseconds. GPIB-232/485CT-A User Manual 5-40 www.ni.com...
GPIB-232/485CT-A processes programming messages and data. This function tells the GPIB-232/485CT-A to ignore or not to ignore the occurrence of serial port errors. By default, serial port errors are ignored. Remarks If the argument is 0, the GPIB-232/485CT-A does not ignore serial port errors.
Page 89
Chapter 5 S Mode Functions — spign Example 2 PRINT #1,"spign 1" 'Execute all programming messages and 'send all data, even if serial port 'errors occur. GPIB-232/485CT-A User Manual 5-42 www.ni.com...
Page 90
. Use to return the device to local program mode. If you call with an argument and the GPIB-232/485CT-A is not System Controller, the ESAC error is recorded. If you call without an argument, the GPIB-232/485CT-A returns its current remote status: 1 = remote, 0 = local.
0 indicates that the condition is not in effect. Because more than one GPIB-232/485CT-A condition can exist at one time, more than one bit can be set in status. The highest order bit of status, also called the sign bit, is set when the GPIB-232/485CT-A...
Table 5-3. S Mode GPIB Error Conditions Returned by stat Numeric Value (n) Symbolic Value (s) Description NGER No GPIB error condition to report ECIC Command requires GPIB-232/485CT-A to be CIC ENOL Write detected no Listeners EADR GPIB-232/485CT-A not addressed correctly EARG Invalid argument or arguments...
Page 94
A detailed description of the conditions under which each bit in status is set or cleared can be found in Appendix C, Status and Error Message Information. In general, the GPIB-232/485CT-A updates the first three status variables at the end of each programming message. It updates the fourth status variable, , after a , or count function.
Page 95
'NGER<CR><LF>NSER<CR><LF>3<CR><LF> Example 3 The following list illustrates what appears on the screen when you are programming the GPIB-232/485CT-A from a terminal. GPIB-232/485CT-A responses are in bold text. The statements in parentheses are comments. stat c s n (Enable continuous status reporting.) CMPL,REM,ATN,TACS ( Status returned.
Page 96
, and functions. If the timeio GPIB-232/485CT-A cannot complete any of these functions within the period of time set by , it aborts the function and records the EABO error. Bytes that were transferred before timeio the timeout are not affected. The...
Page 97
PRINT #1,"tmo 30" 'Set timeout for I/O operations to 30 'seconds. Example 2 PRINT #1,"tmo" 'Print current timeout settings. response: 30,.1<CR><LF> Example 3 PRINT #1,"tmo ,1" 'Set serial poll timeout for one second; 'leave I/O timeout unchanged. GPIB-232/485CT-A User Manual 5-50 www.ni.com...
Page 98
If this is the first function you call that requires GPIB Controller capability, and you have not disabled System Controller capability with , the GPIB-232/485CT-A sends Interface Clear (IFC*) to make itself CIC. It also asserts Remote Enable. 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.
You then check that status to see if the SRQI bit is set in the returned status indicators. To prevent the GPIB-232/485CT-A from waiting indefinitely for SRQ* to be asserted, set the SRQI and TIMO bits by setting the mask equal to (16384 + 4096).
, timeouts for this function are timeio disabled. You should disable timeouts only when you are sure that the selected event occurs. Otherwise, the GPIB-232/485CT-A waits indefinitely for the event to occur. If you call without an argument, the GPIB-232/485CT-A records the EARG error.
Page 101
PRINT #1,"wait 4" 'Wait indefinitely to become LACS. INPUT#1,STATUS%,GPIBERR%,SPERR%,COUNT% 'Get status info. PRINT #1,"rd #10" 'Now that GPIB-232/485CT-A is addressed 'to listen, read 10 bytes from the GPIB. RESP$=INPUT$(10,#1) 'Input 10 bytes from serial port buffer. INPUT #1,CNT% 'Input number of valid bytes in CNT$.
Page 102
<CR> character alone. Use either <LF> or <CR><LF> to terminate the programming message. If you use <CR> alone, and the first character of the data string is <LF>, the GPIB-232/485CT-A discards the <LF> as the second character of a <CR><LF> termination.
Page 103
If one of the errors described above occurs the count might be less than expected. If an error occurs and the GPIB-232/485CT-A is unable to transmit the entire data string, the GPIB-232/485CT-A reads in and discards the remaining bytes of the data string.
Page 104
XOFF over the serial port when its serial receive buffer is almost full. This tells the sender to stop sending data. When the GPIB-232/485CT-A serial port receive buffer is ready to receive more bytes, the GPIB-232/485CT-A sends XON over the serial port.
Page 105
Chapter 5 S Mode Functions — xon If you call without an argument, the GPIB-232/485CT-A returns the current handshake settings: 1 if the protocol is enabled or 0 if protocol is disabled. The assignment made by remains in effect until you call...
Page 106
Programming in G Mode This chapter describes how to program the GPIB-232/485CT-A in G mode. It describes status and error handling information, programming considerations, programming messages, function arguments, addressing in G mode, GPIB read and write termination methods, serial port transmissions, and the G mode functions.
Page 107
, followed by a carriage return. spset WRT$="SPSET"+CHR$(13) CALL IBWRT(GPIB232%,WRT$) If you are not using the National Instruments NI-488.2 software, be sure your program properly addresses the GPIB-232/485CT-A and the serial device when writing to and reading from them. •...
Page 108
WRT2$="XON 1,1"+CHR$(13) CALL IBWRT(GPIB232%,WRT$) • You could also put both messages in one string and send it to the GPIB-232/485CT-A in one GPIB write as in the following example: WRT$="SPSET 1200,n,8"+CHR$(13)+"XON 1,1"+CHR$(13) CALL IBWRT(GPIB232%,WRT$) How Messages are Processed The GPIB-232/485CT-A processes each programming message on a line-by-line basis.
Address of the GPIB-232/485CT-A The address of the GPIB-232/485CT-A is the primary address you set with the DIP switch on the rear panel, with secondary addressing disabled.
Address the serial device to listen by sending the serial device listen address to the GPIB-232/485CT-A. Send your data file over the GPIB. The GPIB-232/485CT-A sends the data to the printer without examining it for meaning. The LISTEN LED on the GPIB-232/485CT-A is lit when either the GPIB-232/485CT-A or the serial device is addressed to listen.
This information helps you decide how much data to continue to collect from the serial device. The TALK LED on the GPIB-232/485CT-A is lit when either the GPIB-232/485CT-A or the serial device is addressed to talk.
Serial poll the GPIB-232/485CT-A and check the serial poll response byte to see if its SERR bit is set. Refer to Serial Poll Responses later in this chapter. You can program the GPIB-232/485CT-A to ignore serial port errors using function. spign...
— Not Used Service Request Conditions You can program the GPIB-232/485CT-A to assert Service Request (SRQ*) in a variety of cases. After you power on, the GPIB-232/485CT-A defaults to never asserting service request. Using the function, you srqen can program the GPIB-232/485CT-A to assert SRQ* under any of the following circumstances: •...
Programming in G Mode Take Control (TCT) This command has no effect on the GPIB-232/485CT-A. It would not make sense for control to pass to the GPIB-232/485CT-A, since all programming messages and GPIB commands must be sent to it from another GPIB device.
Chapter 6 Programming in G Mode G Mode Default Settings and Related Functions Tables 6-2 and 6-3 list power-on characteristics of the GPIB-232/485CT-A and the functions you can use to change those characteristics. Table 6-2. G Mode Serial Port Characteristics...
Chapter 6 Programming in G Mode GPIB Functions GPIB functions manage the GPIB port of the GPIB-232/485CT-A. • • srqen Serial Port Functions Serial port functions initialize and manage the serial port of the GPIB-232/485CT-A. • echo • spset •...
Page 117
Chapter 6 Programming in G Mode Table 6-4. Alphabetical List of G Mode Functions (Continued) Function Purpose mask Set conditions for asserting SRQ* srqen options Return GPIB-232/485CT-A status stat modes Change serial port XON/XOFF protocol GPIB-232/485CT-A User Manual 6-12 www.ni.com...
Page 118
G Mode Functions This chapter contains descriptions of the G mode functions that you can use to program the GPIB-232/485CT-A. These functions are in alphabetical order for easy reference. For general information about using G mode functions, refer to Chapter 6, Programming in G Mode.
In a debugging environment, the success of your communication with the serial device might be unclear. In this case, you could connect a terminal to the GPIB-232/485CT-A instead of connecting the serial device. Then the data that the GPIB-232/485CT-A would send to the serial device is displayed on the terminal screen.
Remarks applies only when the GPIB-232/485CT-A has received the serial device talk address and is sending serial data to the GPIB. It does not apply when the GPIB-232/485CT-A reads serial data or programming messages from the GPIB. The arguments , and specify GPIB data transfer termination methods.
Page 122
EOS modes are disabled. By default, all EOS modes are disabled. If you call without an argument, the GPIB-232/485CT-A returns the current settings. The assignment made by this function remains in effect until you call again, you call or you turn off the GPIB-232/485CT-A.
Page 123
The second string is a copyright notice. The third string identifies the number of bytes of RAM in the GPIB-232/485CT-A. The following example shows the current identification string at the time of this printing. The general format will be as shown;...
Page 124
0 if the GPIB-232/485CT-A is offline and 1 if the it is online. Placing the GPIB-232/485CT-A offline is like disconnecting its serial cable from the serial device. When placed offline, no data is sent out the GPIB-232/485CT-A serial port and data coming in to the GPIB-232/485CT-A serial port is not saved until is called with = 1.
This function tells the GPIB-232/485CT-A to ignore or not to ignore the occurrence of serial port errors. By default, the GPIB-232/485CT-A ignores serial port errors.
<CR> spset [baud] [parity] [databits] [stopbits] Purpose You can use at the beginning of your program to set the GPIB-232/485CT-A serial port spset characteristics (baud rate, parity, data bits, and stop bits) to match those required by your serial device.
Page 127
Chapter 7 G Mode Functions — spset Example 2 'What are the current GPIB-232/485CT-A serial port settings? WRT$="SPSET"+CHR$(13) CALL IBWRT(GPIB232%,WRT$) 'RESP$ will contain 9600,N,7,2<CR><LF> '(9600 baud, no parity, 7 data bits, '2 stop bits). CALL IBRD(GPIB232%,RESP$) Example 3 'Set the GPIB-232/485CT-A serial port to 1200 'baud, no parity, 8 data bits, and 1 stop bit.
Enable/Disable Setting of SRQ* Type GPIB function Syntax <CR> srqen [mask] Purpose You can use when you want to allow the GPIB-232/485CT-A to assert SRQ* under srqen the conditions described in Chapter 6, Programming in G Mode, the section entitled Service Request Conditions.
Page 129
The power on default of is disabled—that is, SRQ* is never asserted. srqen If you call without an argument, the GPIB-232/485CT-A returns a decimal string that srqen indicates the decimal value of the current setting. The assignment made by remains in effect until you call...
The highest order bit of status, also called the sign bit, is set when the GPIB-232/485CT-A detects either a GPIB error or a serial port error. When status is negative, an error condition exists.
G Mode Functions — stat Table 7-3 lists the values and descriptions of GPIB status conditions that might be returned by the function. stat Table 7-3. G Mode GPIB-232/485CT-A Conditions Returned by stat Numeric Value (n) Symbolic Value (s) Description –32768...
Information, includes a detailed description of the conditions under which each bit in status is set or cleared. The GPIB-232/485CT-A updates the status and count variables at the end of each programming message. The serial and GPIB error variables are updated whenever a new error occurs and are cleared automatically when status is reported.
Page 133
STATUS$=SPACE$(10) : GPIBERR$=SPACE$(10) SPERR$=SPACE$(10) : COUNT$=SPACE$(10) CALL IBRD(GPIB232%,STATUS$) 'Read up to 10 bytes of each piece of status. 'The GPIB-232/485CT-A returns 4 pieces of 'status. We are set up to terminate 'IBRD on linefeed, which is what 'terminates each piece of status.
Page 134
PRINT "GPIB-232/485CT-A status is: ";RD$ Example 3 'Turn on continuous status reporting, 'in symbolic format. WRT$="stat c s"+CHR$(13) CALL IBWRT(GPIB232%,WRT$) 'Read the GPIB-232/485CT-A status; read 50 'bytes or until EOI is received. RD$=SPACE$(50) CALL IBRD(GPIB232%,RD$) 'Print the status information. PRINT "GPIB-232/485CT-A status is: ";RD$...
Page 135
XOFF over the serial port when its serial port receive buffer is almost full. This tells the sender to stop sending data. When the GPIB-232/485CT-A serial port receive buffer is ready to receive more bytes, the GPIB-232/485CT-A sends XON over the serial port.
Page 136
Chapter 7 G Mode Functions — xon If you call without an argument, the GPIB-232/485CT-A returns the current handshake setting: 1 if the protocol is enabled or 0 if protocol is disabled. The assignment made by remains in effect until you call...
Page 137
Specifications This appendix contains tables which specify the electrical, environmental, and physical characteristics of the GPIB-232/485CT-A, as well as the IEEE 488 capability codes. Electrical Characteristics AC Version Power supply unit (50–60 Hz) ....100–120 VAC ± 10% or 220–240 VAC ± 10% Current 100–120 VAC .........
Page 138
Case material ..........All metal enclosure Weight ............340 g (12 oz) DC Version Overall case size (dimensions) ....118.1 by 76.2 by 28.2 mm (4.65 by 3.0 by 1.11 in.) Case material ..........All metal enclosure Weight ............198 g (7 oz) GPIB-232/485CT-A User Manual www.ni.com...
Appendix A Specifications The IEEE 488 standard specifies allowable subsets of interface functions. The codes supported by the GPIB-232/485CT-A are detailed in Table A-1. For more information, refer to the ANSI/IEEE Standard 488.1-1987, IEEE Standard Digital Interface for Programmable Instrumentation.
Page 143
My Secondary Address U N L Unlisten My Talk Address U N T Untalk Parallel Poll Configure † This multiline interface message is a proposed extension to the IEEE 488 specification to support the HS488 protocol. GPIB-232/485CT-A User Manual www.ni.com...
Page 144
Status and Error Message Information This appendix describes the status and error information that the GPIB-232/485CT-A records as it executes each programming message. This information is returned in response to the command, or stat automatically after each command if continuous status reporting is enabled.
Page 145
The LOK bit is set whenever the GPIB-232/485CT-A detects the Local Lockout (LLO) message has been sent either by the GPIB-232/485CT-A or by another Controller. The LOK bit is cleared when the Remote Enable (REN*) GPIB line becomes unasserted.
Page 146
LOK bit is cleared in status. A call to also clears REM. S mode The CIC bit specifies whether the GPIB-232/485CT-A is the Controller-In-Charge. The CIC bit is set whenever called while the GPIB-232/485CT-A is System Controller, or when another Controller passes control to the GPIB-232/485CT-A.
Page 147
NGER S or G mode The GPIB-232/485CT-A reports this error when GPIB-232/485CT-A detected no GPIB errors as a result of the last operation. ECIC S mode The GPIB-232/485CT-A records this value when you call a function that requires that the GPIB-232/485CT-A be CIC and it is not CIC.
Page 148
GPIB-232/485CT-A. ENOL S mode The ENOL error occurs most frequently when the GPIB-232/485CT-A attempts to write data to the GPIB and no Listeners are addressed. To correct this error, be sure that the proper listen address is in the argument string, use...
Page 149
Appendix C Status and Error Message Information EARG S or G mode The GPIB-232/485CT-A records this error when you pass an invalid argument to a function call. The following are some examples: • called with a value not in the range .00001 to 3600 •...
Page 150
The following paragraphs describe the serial port errors in detail. The number preceding each description is the numeric value of the error code. In S mode, when a serial port error occurs as the GPIB-232/485CT-A receives a programming message, the error is recorded and the message is discarded.
Page 151
Appendix C Status and Error Message Information NSER The GPIB-232/485CT-A reports this value when there is no serial port error detected as a result of the last operation. EPAR The GPIB-232/485CT-A records this error when the parity of the received character is not what was expected; one or more bits of the received character were corrupted in a way that changed the character’s parity.
(A DCE is now called Data Circuit-Terminating Equipment in Revision D of the RS-232 specification.) In general, DTE and DCE refer to computer equipment and modems respectively. Because the RS-232 specification mainly involved connecting GPIB-232/485CT-A User Manual www.ni.com...
The connections must be implemented. Figure D-4 shows a properly configured 9-pin DTE to 9-pin DCE cable including the hardware handshake lines RTS, CTS, and DTR. With this configuration, the GPIB-232CT-A can function properly (handshake) on GPIB-232/485CT-A User Manual www.ni.com...
Use a minimum configuration null modem cable which does not support the hardware handshake lines and use XON/XOFF software handshaking (if necessary). To create a minimum configuration cable, connect the signals shown in bold italics in Table D-3. GPIB-232/485CT-A User Manual www.ni.com...
Page 161
ANSI/EIA-232-D standard is a good reference, provided your device conforms to the RS-232 protocol. Caution Although handshaking might not be required, it is best to use some form of handshaking to prevent loss of data. GPIB-232/485CT-A User Manual D-10 www.ni.com...
D-Subminiature connector. Figure E-1 shows the pin locations on the connector. Table E-1 shows the signal lines supported on the GPIB-485CT-A. CTS–(HSI–) CTS+(HSI+) RTS–(HSO–) RTS+(HSO+) TXD+ RXD+ TXD– RXD– Figure E-1. Male DB-9 Connector Pin Locations GPIB-232/485CT-A User Manual www.ni.com...
Page 165
The GPIB-485CT-A is a full-duplex, point-to-point device. Separate wires must be connected for the TXD, RXD, CTS, and RTS lines. For example, to connect the GPIB-485CT-A to a National Instruments AT-485 serial interface, you would need to make the connections shown in Table E-2.
Page 168
A Controller is necessary when the active or addressed Talker or Listener must be changed. The Controller functions are usually handled by a computer. The GPIB-232/485CT-A as Talker, Listener, and Controller In S mode, the GPIB-232/485CT-A performs the following three roles: • Controller—to manage the GPIB •...
Page 169
Appendix F GPIB Basics In G mode, the GPIB-232/485CT-A acts as a GPIB device. It performs only the following two roles: • Talker—to send data to the GPIB host • Listener—to receive data from the GPIB host The Controller-In-Charge and System Controller Although the GPIB can have multiple Controllers, only one Controller at a time is active, or Controller-In-Charge (CIC).
NRFD* (Not Ready for Data) NRFD* indicates when a device is ready or not ready to receive a message byte. The line is driven by all devices when receiving commands and by Listeners when receiving data messages. GPIB-232/485CT-A User Manual www.ni.com...
TTL low level (≤ 0.8 V), and when DAV* is false, it is a TTL high level (≥ 2.0 V). Serial Cable GPIB-232CT-A GPIB Cables Device A Device B Device C Figure F-2. Linear Configuration of GPIB Devices GPIB-232/485CT-A User Manual www.ni.com...
Page 174
This appendix contains answers to common questions about S mode and G mode. S Mode Questions Why is there an unmarked DIP switch on my GPIB-232/485CT-A? The second DIP switch is reserved for future expansion and should remain OFF. Why does the manual suggest that I use...
Page 175
(<CR><LF>) as a response. Am I doing something wrong? No. To conduct a serial poll, the GPIB-232/485CT-A must be CIC or it must be able to become Controller-In-Charge. If the GPIB-232/485CT-A cannot become CIC, no serial poll is conducted, and therefore you do not get a response string.
Page 176
After I write the programming message to the "stat c s"+chr$(13) GPIB-232/485CT-A in G mode, my system times out when I try to read status. Why? Make sure you have addressed the GPIB-232/485CT-A to talk. To read responses to programming messages you send to the GPIB-232/485CT-A, you must address the GPIB-232/485CT-A to talk using the address you selected on the configuration switch and adding decimal 64 to it.
PP2 option of the function. When the PP2 conf option is cleared (the default), the GPIB-232/485CT-A uses PP subset PP1. This causes the GPIB-232/485CT-A to accept only those configurations that come over the GPIB from an external Controller. When the PP2 option is set, the GPIB-232/485CT-A uses PP subset PP2.
Page 180
For the function to have an effect, the GPIB-232/485CT-A must be using PP subset PP2. If the GPIB-232/485CT-A is not configured to use PP subset PP2, then it cannot allow itself to be locally configured, and returns an ECAP error. The GPIB-232/485CT-A can be configured to use PP subset PP2 with the function.
Page 181
6D (binary 0110 1101) and parallel polls it while it is asserting SRQ*, it responds by asserting DIO line 6. If the Controller remotely configures the GPIB-232/485CT-A using a PPE message hex 65 (binary 0110 0101) and parallel polls it while it is asserting SRQ*, it responds by not asserting DIO line 6.
8); if it is busy, it unasserts DIO line 4 ( returns hex 0). When the scanner is free, its bit is 0, and because this equals the value of the in the PPE message, the device asserts DIO line 4. GPIB-232/485CT-A User Manual www.ni.com...
Page 183
The PC configures all of the line printers (at addresses 1, 2, and 3) to respond positively on DIO line 5 when busy by sending the following programming message to the GPIB-232/485CT-A: ppc 1,5,1 2,5,1 3,5,1<CR> This programming message causes a PPE message of hex 6C to be sent to each of the line printers.
This programming message causes a PPE message of hex 68 to be sent to each of the line printers. When a parallel poll is conducted by calling the PC can find out if any line printer is free or if all line printers are busy. GPIB-232/485CT-A User Manual www.ni.com...
Page 185
Programming Steps and Examples This appendix contains program examples you can use as guidelines as you start writing programs for the GPIB-232/485CT-A. The first part of the appendix applies to S mode. The remainder of the appendix applies to G mode.
Before you start programming, determine the serial port settings you need by looking at the settings of your terminal. Set the configuration switches on the GPIB-232/485CT-A so that they match the terminal characteristics. Figure I-1 shows how to configure the GPIB-232/485CT-A if your terminal has the following...
Page 188
BASIC to draw a circle using an HP 7475A Plotter. Preparing to Program Before you start programming, determine the serial port settings you need. Set the configuration switches on the GPIB-232/485CT-A. Figure I-2 shows how to configure the GPIB-232/485CT-A for the following characteristics: Baud rate...
Figure I-2. Sample Switch Settings for an IBM PC and HP Plotter Connect the serial cable to the serial port of your computer and to the GPIB-232/485CT-A. Connect the GPIB cable to your device and the GPIB-232/485CT-A. Power on the GPIB-232/485CT-A. Programming Steps Step 1.
Page 190
Send GPIB initialization functions if you need to change default GPIB settings. Send serial port initialization functions if you need to change default serial port settings. Communicate with the serial device and obtain status from the GPIB-232/485CT-A, if desired. GPIB-232/485CT-A User Manual www.ni.com...
To send data to the device you must address the device. To send programming messages to the GPIB-232/485CT-A, you must address the GPIB-232/485CT-A. The GPIB software you use on the Controller side can provide high-level calls that perform this addressing automatically.
Page 192
Stop bits The number of data bits do not match, so you must change the default setting of the GPIB-232/485CT-A before you read or write from the plotter. You accomplish this during the programming steps. Connect the GPIB cable to the GPIB port on your computer and to the GPIB-232/485CT-A.
Page 193
Step 3. Send the Serial Port Initialization Functions Change any serial port initialization functions, if necessary. This plotter sends and receives 7-bit data. Since the default of the GPIB-232/485CT-A is 8-bit data, send the string 7 to change to 7-bit data transfers. Read spset status after you send the string.
The printer is the Apple Imagewriter. The Controller is an IBM PC with an AT-GPIB interface installed. The following program example prints the message Hello, world Preparing to Program Set the GPIB-232/485CT-A configuration switch to primary address 18, as shown in Figure I-4. S MODE DATA FORMAT BAUD RATE...
Page 195
Next, change any serial port characteristics, if necessary. The serial port characteristics of the GPIB-232/485CT-A must match those of the serial device. Since the baud rate of the printer and the GPIB-232/485CT-A are both 9600, there is no need to initialize the software of the serial port.
Page 196
Programming Steps and Examples 'a minus sign, then go to 'error function. 110 WRT$="Hello, world"+CHR$(13) 115 CALL IBWRT(PRINTER%,WRT$) 'Send string to printer. 120 STOP 125 PRINT "An error occurred:" 130 PRINT "status, GPIB-error, serial-error, 135 count:";RD% 140 END GPIB-232/485CT-A User Manual I-12 www.ni.com...
Page 197
Technical Support Resources This appendix describes the comprehensive resources available to you in the Technical Support section of the National Instruments Web site and provides technical support telephone numbers for you to use if you have trouble connecting to our Web site or if you do not have internet access.
If you have trouble connecting to our Web site, please contact your local National Instruments office or the source from which you purchased your National Instruments product(s) to obtain support. For telephone support in the United States, dial 512 795 8248. For...
Page 200
DTAS Device Trigger Active State Data Terminal Equipment Data Terminal Ready Electronic Industries Association end or identify end of string Federal Communications Commission feet grams ground GPIB General Purpose Interface Bus GPIB-232/485CT-A User Manual Glossary-2 www.ni.com...
Page 202
Parallel Poll Enable random-access memory Remote Remote Enable read-only memory Request Service Request to Send Receive Data seconds Service Request SRQI Service Request Input TACS Talker Active State TIMO Timeout Transistor-Transistor Logic Transmit Data GPIB-232/485CT-A User Manual Glossary-4 www.ni.com...
Page 204
S mode, G-1 to G-2 functions, 4-5 conf function, 5-9 to 5-10 S mode function argument, 4-4 to 4-5 configuration addressing GPIB-232/485CT-A and serial checking hardware configuration, 3-1 to 3-2 device connecting devices on GPIB bus, F-6 to F-7 as listeners, 6-4 to 6-5...
Page 205
9 pin DTE to 9-pin DCE gts, 5-17 to 5-18 (figure), D-6 pct, 5-26 9 pin DTE to 25-pin DCE GPIB-232/485CT-A as Controller, (figure), D-6 F-2 to F-3 straight-through cabling, D-2 to D-3 role of GPIB controller, F-2 default settings for GPIB-232CT-A, 3-1...
Page 207
6-4 END message, 6-6 as listeners, 6-4 to 6-5 EOS character, 6-6 as talkers, 6-5 to 6-6 operation of GPIB-232/485CT-A as GPIB device, 6-7 to 6-9 GPIB-232/485CT-A address, 6-4 Device Clear (DCL) command, 6-9 serial device address, 6-4...
Page 209
5-21 GPIB-232CT-A, 1-2 LISTEN LED (table), 1-4 GPIB-485CT-A, 1-2 to 1-8 Listeners rear panel, 1-4 to 1-5 addressing GPIB-232/485CT-A and requirements for getting serial device as listeners, 6-5 started, 1-1 to 1-2 checking with ln function, 5-22 RS-232 connector, 1-6...
Page 210
B-1 to B-4 parallel poll message (PPE or PPD) bits (figure), H-2 examples, H-5 to H-8 operation of, H-1 National Instruments Web support, J-1 to J-2 programming GPIB-232/485CT-A, 6-8 NDAC (not Data Accepted) line, F-5 pct function, 5-26 NGER error code, C-4 physical characteristics NI-488.2 software, 4-1...
Page 211
5-36 to 5-37 id, 5-19 rsv function, 5-38 I/O functions, 4-7 RTS+ (HSO+) signal, RS-485 port (table), E-3 ist, 5-20 RTS– (HSO–) signal, RS-485 port (table), E-3 lines, 5-21 RTS signal, RS-232 port (table), D-2 ln, 5-22 GPIB-232/485CT-A User Manual Index-8 www.ni.com...
Page 212
See null-modem serial cable. GPIB error conditions returned serial device (table), 5-46 address for, 6-4 purpose and use, 5-44 to 5-47 addressing GPIB-232/485CT-A and serial port error conditions returned serial device, 6-4 (table), 5-46 as listeners, 6-4 to 6-5 status conditions returned...
Page 213
G mode (table), 7-15 programming, 6-7 status conditions returned service request conditions (SRQ), 6-8 (table), 7-14 sic function, 5-39 to 5-40 S mode, 5-44 to 5-48 side panels, GPIB connector, 1-8 examples, 5-47 to 5-48 GPIB-232/485CT-A User Manual Index-10 www.ni.com...
Page 214
(table), 5-45 serial device as talkers, 6-5 to 6-6 status bits, C-1 to C-4 definition, F-2 ATN, C-3 GPIB-232/485CT-A as Talker, F-2 to F-3 CIC, C-3 technical support resources, J-1 to J-2 CMPL, C-2 TIMO status bit, C-1 to C-2...
Need help?
Do you have a question about the GPIB-232 and is the answer not in the manual?
Questions and answers