background image

Chapter 5

S Mode Functions — stat

©

 National Instruments Corporation

5-47

GPIB-232/485CT-A User Manual

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, 

count

, after a 

cmd

rd

, or 

wrt

 

function. The errors reported correspond to the previous programming message. For example, 
if you call 

wrt

 and then 

stat s

, any errors returned to you correspond to errors in the 

wrt

 

programming message, not 

stat

. However, if status is returned in continuous mode, the 

status information corresponds to the current programming message. For example, suppose 
you called 

stat c s

 to set up continuous status reporting. After reading the status 

information returned from the 

stat

 call, you call 

wrt

. The GPIB-232/485CT-A then returns 

the status information that corresponds to the 

wrt

 message. 

When you want to begin continuous status reporting, send the 

stat c s

stat c n

, or 

stat 

c n s

 programming message. Status information is immediately returned indicating the 

current status conditions. When you call 

stat

 with both 

s

 and 

n

 the numeric status is always 

returned first.

Notice that when you send several programming messages to the GPIB-232/485CT-A, 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 
sending the next, the GPIB-232/485CT-A waits for each subsequent programming message 
to arrive at the serial port before processing it. This slows down the overall performance of 
your program. If speed is a primary concern, disable continuous status reporting.

The continuous status setting remains in effect until you call 

stat

 again, call 

onl

, or you turn 

off the GPIB-232/485CT-A. 

Example 1

10

PRINT #1,"stat n"

'Get GPIB-232/485CT-A status.

20

'GPIB-232/485CT-A responds with:

30

'340<CR><LF>0<CR><LF>0<CR>

40

'<LF>0<CR><LF>. Now read 

50

'status into variables.

60

INPUT#1,STATUS%,GPIBERR%,SPERR%,COUNT%

70

'Go to error routine at 500 if error.

90

IF STATUS% < 0 THEN GOTO 500

100

'Go to SRQ service routine 

110

'if SRQ is asserted

120

IF (STATUS% AND &H1000) THEN GOTO 400

410

' Place code here to service SRQ.

500

'Print GPIB-error and serial-error 

'values to determine what errors 

530

'occurred.

Summary of Contents for GPIB-232

Page 1: ...GPIB GPIB 232 485CT A User Manual GPIB 232 485CT A User Manual November 1999 Edition Part Number 370898A 01...

Page 2: ...4 24 24 Germany 089 741 31 30 Greece 30 1 42 96 427 Hong Kong 2645 3186 India 91805275406 Israel 03 6120092 Italy 02 413091 Japan 03 5472 2970 Korea 02 596 7456 Mexico D F 5 280 7625 Mexico Monterrey...

Page 3: ...vice failures caused by owner s failure to follow the National Instruments installation operation or maintenance instructions owner s modification of the product owner s abuse misuse or negligent acts...

Page 4: ...interference to radio and television reception Classification requirements are the same for the Federal Communications Commission FCC and the Canadian Department of Communications DOC Changes or modif...

Page 5: ...s Cet appareil num rique de la classe B respecte toutes les exigences du R glement sur le mat riel brouilleur du Canada European Union Compliance to EEC Directives Readers in the EU EEC EEA must refer...

Page 6: ...485 Connector 1 7 GPIB Connector 1 8 Chapter 2 Operating in S Mode and G Mode Choosing Between S Mode and G Mode 2 1 Operating in S Mode 2 1 Operating in G Mode 2 2 Data Buffering and Handshaking Sch...

Page 7: ...Programming Message Format 4 2 Programming Message Example 1 4 3 Programming Message Example 2 4 3 Programming Message Example with Data String 4 3 How Messages are Processed 4 4 Function Arguments 4...

Page 8: ...Characteristics 6 1 Programming Considerations 6 1 Programming Messages 6 2 Programming Message Format 6 2 Programming Message Example 1 6 2 Programming Message Example 2 6 3 How Messages are Processe...

Page 9: ...6 9 Function Names 6 9 G Mode Default Settings and Related Functions 6 10 List of G Mode Functions by Group 6 10 GPIB Functions 6 11 Serial Port Functions 6 11 General Use Functions 6 11 Alphabetical...

Page 10: ...The DC Version Rear Panel 1 4 Figure 1 4 The AC Version Rear Panel 1 5 Figure 1 5 Location of the Connectors and the DC Power Jack 1 5 Figure 1 6 The RS 232 Connector and Signal Designations 1 6 Figu...

Page 11: ...to 25 pin DTE D 9 Figure E 1 Male DB 9 Connector Pin Locations E 2 Figure E 2 Point to Point Network Using Terminating Resistors E 5 Figure F 1 GPIB Connector Signals and Lines F 4 Figure F 2 Linear...

Page 12: ...Table 6 4 Alphabetical List of G Mode Functions 6 11 Table 7 1 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 Retur...

Page 13: ...ther the GPIB 232CT A or GPIB 485CT A box IEEE 488 and IEEE 488 and IEEE 488 2 refer to the ANSI IEEE Standard 488 1 1987 IEEE 488 2 and the ANSI IEEE Standard 488 2 1992 respectively which define the...

Page 14: ...I EIA 232 D Interface Between Data Terminal Equipment and Data Circuit Terminating Equipment Employing Serial Binary Data Interchange EIA 485 Standard for Electrical Characteristics of Generators and...

Page 15: ...hich is included in your kit GPIB 232CT A 100 120 VAC GPIB 232CT A 220 240 VAC GPIB 232CT A DC GPIB 485CT A 100 120 VAC GPIB 485CT A 220 240 VAC GPIB 485CT A DC If you have an AC version one of the fo...

Page 16: ...and electrical specifications of the IEEE 488 and RS 232 standards It can interpret and execute high level commands that you send to it over the serial port performing GPIB to RS 232 protocol conversi...

Page 17: ...the GPIB 232 485CT A front panel on the AC version only Figure 1 1 shows the front panel of the AC version Figure 1 1 The AC Version Front Panel Top Panel The six light emitting diodes LEDs are locat...

Page 18: ...1 3 The DC Version Rear Panel Table 1 1 LED Descriptions LED Indication POWER Indicates that power to the unit has been applied and the ON OFF switch is in the ON position READY Indicates that the pow...

Page 19: ...he DC version the DC power jack is located next to the serial connector Figure 1 5 shows the location of the serial and GPIB connectors and the DC power jack Figure 1 5 Location of the Connectors and...

Page 20: ...connector with screwlock assemblies The RS 232 connector accepts standard 9 pin D Subminiature female connectors Figure 1 6 shows a diagram of the RS 232 connector and the signals supported For more...

Page 21: ...tor with screwlock assemblies The RS 485 connector accepts standard 9 pin D Subminiature female connectors Figure 1 7 shows a diagram of the serial connector and the signals supported For more informa...

Page 22: ...that the signal is active low Refer to Appendix F GPIB Basics for more information about the GPIB signal lines Figure 1 8 The GPIB Connector and Signal Designations DIO1 DIO2 DIO3 DIO4 EOI DA V NRFD...

Page 23: ...re 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 If the serial devi...

Page 24: ...your GPIB 232 485CT A to operate in S mode Refer to Chapter 4 Programming in S Mode and Chapter 5 S Mode Functions for information on programming the GPIB 232 485CT A in S mode Operating in G Mode Th...

Page 25: ...A does not lose incoming serial data data buffering and handshaking The GPIB 232 485CT A has an internal RAM buffer that stores incoming serial data until it can output the data to the GPIB port The...

Page 26: ...485CT A you can achieve bidirectional flow control by using a serial cable that connects the GPIB 232 485CT A RTS signal s to the serial device CTS signal s In addition the serial device RTS signal s...

Page 27: ...inary data as opposed to 7 bit ASCII do not configure the GPIB 232 485CT A to use XON XOFF software handshaking Because the binary data could contain any binary sequence including decimal 19 Ctrl S or...

Page 28: ...pply matches the voltage that is supplied in your area Caution Do not operate your GPIB 232 485CT A at any voltage other than the one marked on your GPIB 232 485CT A Doing so could damage the unit Rep...

Page 29: ...Cables 1 Connect the serial cable to the GPIB 232 485CT A serial connector and securely fasten the holding screws Connect the other end of the cable to your serial device Be sure to use only shielded...

Page 30: ...fter the GPIB 232 485CT A has passed its power on self test indicating the unit is ready for operation If the READY LED does not come on within seven seconds after the unit is powered on recheck all c...

Page 31: ...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...

Page 32: ...s serial port 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 y...

Page 33: ...ata 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 F...

Page 34: ...ting that the GPIB 232 485CT A is at GPIB address 5 and the serial device is at GPIB address 6 Switches 6 7 and 8 are OFF OFF and ON respectively indicating that the GPIB 232 485CT A is operating in G...

Page 35: ...F OFF OFF OFF 0 1 ON OFF OFF OFF OFF 1 2 OFF ON OFF OFF OFF 2 3 ON ON OFF OFF OFF 3 4 OFF OFF ON OFF OFF 4 5 ON OFF ON OFF OFF 5 6 OFF ON ON OFF OFF 6 7 ON ON ON OFF OFF 7 8 OFF OFF OFF ON OFF 8 9 ON...

Page 36: ...Manual ON ON ON OFF ON 23 24 OFF OFF OFF ON ON 24 25 ON OFF OFF ON ON 25 26 OFF ON OFF ON ON 26 27 ON ON OFF ON ON 27 28 OFF OFF ON ON ON 28 29 ON OFF ON ON ON 29 30 OFF ON ON ON ON 30 0 Table 3 4 GPI...

Page 37: ...use the NI 488 2 software refer to the NI 488 2 user manual and NI 488 2 function reference manual Contact National Instruments for ordering information if you do not have the NI 488 2 software packag...

Page 38: ...criptions that follow these functions are marked with an asterisk You can use function name abbreviations which include only as many characters as necessary to distinguish them from other functions Th...

Page 39: ...bed a CR denoted by CHR 13 or a LF denoted by CHR 10 in the statement For example to send the two programming messages send interface clear sic and send remote enable sre you could use either of these...

Page 40: ...itional argument with at least one space or a comma In the syntax portions of the function descriptions in Chapter 5 S Mode Functions the information within the square brackets is optional If you want...

Page 41: ...ng A numeric string represents an integer which you can express using decimal octal or hexadecimal digits To specify an octal integer precede the numeric string with a backslash To specify a hexadecim...

Page 42: ...ion s purpose and make your programs easier to understand However if you want to reduce some overhead in your program you can use an abbreviation of the name that includes only as much of the function...

Page 43: ...PIB functions manage the GPIB port of the GPIB 232 485CT A The GPIB function subgroups are listed with the most frequently used groups first Often the I O and high level bus management functions are t...

Page 44: ...various configurations of the GPIB port caddr eos eot onl rsc tmo Serial Poll Functions conduct and respond to GPIB serial polls rsp rsv Low Level Bus Management Functions give you precise control ove...

Page 45: ...ode Functions Table 4 3 lists all of the S mode functions in alphabetical order Table 4 3 Alphabetical List of S Mode Functions Function Purpose cac mode Become Active Controller caddr address Change...

Page 46: ...l Unconfigure rd count address Read data rpp Conduct request a Parallel Poll rsc on off Request System Control rsp address list Conduct request a serial poll rsv status byte Request service and or set...

Page 47: ...Chapter 4 Programming in S Mode National Instruments Corporation 4 11 GPIB 232 485CT A User Manual For more detailed information on each function refer to Chapter 5 S Mode Functions...

Page 48: ...m 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 In t...

Page 49: ...hronously If the argument bool is 1 the GPIB 232 485CT A takes control after any handshake that is in progress completes that is it takes control synchronously If you call cac without an argument the...

Page 50: ...Chapter 5 S Mode Functions cac National Instruments Corporation 5 3 GPIB 232 485CT A User Manual Example 3 PRINT 1 CAC Are we the Active Controller response 1 CR LF yes we are CAC...

Page 51: ...s is separated from the primary address by a plus sign Both addresses are expressed as numeric strings If you specify a primary address without a secondary address secondary addressing is disabled If...

Page 52: ...S Mode Functions caddr National Instruments Corporation 5 5 GPIB 232 485CT A User Manual Example 3 PRINT 1 CADDR Return current GPIB 232 485CT A address response 1 CR LF current GPIB 232 485CT A addr...

Page 53: ...devices specified in alist Selected Device Clear If you call clr without alist the GPIB 232 485CT A clears all devices Device Clear If clr is the first function you call that requires gpib Controller...

Page 54: ...messages The argument count is a numeric string preceded by a number sign count specifies the number of GPIB command bytes interface messages to send and can range from 1 to 4294967295 count must not...

Page 55: ...t 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...

Page 56: ...ted The PP2 option is used to indicate what type of parallel poll configurations the GPIB 232 485CT A should accept If the PP2 value is 0 the GPIB circuitry of the GPIB 232 485CT A uses the IEEE 488 P...

Page 57: ...Chapter 5 S Mode Functions conf GPIB 232 485CT A User Manual 5 10 www ni com Example 2 PRINT 1 conf 0 Return the current setting for the PP2 option response 1 CR LF PP2 mode selected...

Page 58: ...haracters are not echoed If the argument bool is 1 and echoing was previously disabled characters are not echoed until this command has been completely processed that is the next programming message i...

Page 59: ...methods They enable or disable the corresponding eos mode If a particular letter is specified the corresponding eos mode is enabled If it is not specified the corresponding eos mode is disabled By def...

Page 60: ...as an argument the GPIB 232 485CT A records the EARG error Note 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 perform...

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 by...

Page 62: ...ds the END message with the last byte of each wrt If the argument bool is 0 END is not sent The power on default is 1 The GPIB 232 485CT A sends the END message by asserting the GPIB EOI signal during...

Page 63: ...th last byte PRINT 1 WRT 3 CHR 10 ABCDE Write data to device at address 3 The EOI line is automatically asserted when the last byte the letter E is sent to tell the Listeners it is the last byte of da...

Page 64: ...GPIB 232 485CT A can then take control synchronously without possibly corrupting the transfer Remarks If the argument bool is 1 shadow handshaking is enabled If the argument bool is 0 shadow handshak...

Page 65: ...not in Standby that is it is the Active Controller CIDLE if the GPIB 232 485CT A is not the CIC that is if it is an Idle Controller The GPIB 232 485CT A must be CIC when you call gts with an argument...

Page 66: ...tring identifies the company product model and software revision level The second string is a copyright notice The third string identifies the number of bytes of RAM in the GPIB 232 485CT A The follow...

Page 67: ...s individual status bit is set to 1 If the argument bool is 0 the GPIB 232 485CT A s individual status bit is cleared The power on default is 0 If you call ist without an argument the GPIB 232 485CT A...

Page 68: ...ach bit in this number corresponds to a GPIB control line as follows The second number contains mask bits in the same order as above indicating which lines are actually being reported and which are in...

Page 69: ...secondary addresses for the specified primary address If this is the first function you call that requires GPIB Controller capability and you have not disabled System Controller capability with rsc t...

Page 70: ...mmand If you call loc without alist and the GPIB 232 485CT A is System Controller the GPIB 232 485CT A returns all devices to local mode by unasserting REN and asserting it again If you call loc witho...

Page 71: ...5 24 www ni com See Also Appendix C 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 PRI...

Page 72: ...r state and configures itself to be the System Controller Placing the GPIB 232 485CT A offline can be thought of as disconnecting its GPIB cable from the other GPIB devices Placing the GPIB 232 485CT...

Page 73: ...addr consists of a primary address and an optional secondary address pct passes CIC authority from the GPIB 232 485CT A to the device specified by addr The GPIB 232 485CT A automatically goes to Idle...

Page 74: ...as any list of arguments If this is the first function you call that requires GPIB Controller capability and you have not disabled System Controller capability with rsc the GPIB 232 485CT A sends Int...

Page 75: ...pu rpp and Appendix H Parallel Polling Example 1 PRINT 1 PPC 18 23 8 0 23 10 7 1 Configure 2 devices for parallel poll PRINT 1 RPP Conduct a Parallel poll of 2 devices configured above response 192 CR...

Page 76: ...and you have not disabled System Controller capability with rsc 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 GPI...

Page 77: ...Mode Functions ppu GPIB 232 485CT A User Manual 5 30 www ni com 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 par...

Page 78: ...receives a Device Clear The EABO error is recorded The addr argument is specified and the requested GPIB addressing bytes cannot be sent The EBUS error is recorded Because you might not know the numb...

Page 79: ...CIC error is recorded When performing the addressing for a specified addr the GPIB 232 485CT A sends out its own listen address as well as the talk address of the specified device It then places itsel...

Page 80: ...me It remains Active Controller after pulsing the IDY message The GPIB 232 485CT A returns the Parallel Poll Response PPR following the poll in the form of a numeric string representing the decimal va...

Page 81: ...485CT A can send the Interface Clear IFC and Remote Enable REN messages to GPIB devices If some other Controller asserts IFC the GPIB 232 485CT A can only respond if it is not configured as System Co...

Page 82: ...onal Instruments Corporation 5 35 GPIB 232 485CT A User Manual Example 2 PRINT 1 rsc 0 Disable system control Example 3 PRINT 1 rsc What is the current System Controller status response 0 CR LF GPIB 2...

Page 83: ...nd another bit to indicate a need for reprogramming Consult the device documentation for interpretation of the response byte Each device serial poll response byte is returned as a numeric string givin...

Page 84: ...ctions rsp National Instruments Corporation 5 37 GPIB 232 485CT A User Manual See Also tmo Example PRINT 1 rsp 1 28 5 9 Poll 3 devices response 42 CR LF device 9 did not respond 30 CR LF within the ti...

Page 85: ...IB 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 a...

Page 86: ...u might want to vary the amount of time IFC is asserted For example you might set time to 10 seconds to allow you to check on a bus analyzer that IFC is actually being asserted Otherwise you do not ne...

Page 87: ...pter 5 S Mode Functions sic GPIB 232 485CT A User Manual 5 40 www ni com Example 1 PRINT 1 sic Send interface clear for 500 microseconds Example 2 PRINT 1 SIC 01 Send interface clear for 10 millisecon...

Page 88: ...ors Also if a serial port error occurs with any byte contained in a cmd or wrt data string the GPIB 232 485CT A discards that data byte and all remaining bytes in the string The serial port errors inc...

Page 89: ...Chapter 5 S Mode Functions spign GPIB 232 485CT A User Manual 5 42 www ni com Example 2 PRINT 1 spign 1 Execute all programming messages and send all data even if serial port errors occur...

Page 90: ...rts REN Many GPIB devices have a remote program mode and a local program mode It is usually necessary to place devices in remote mode before programming them from the GPIB A device enters the remote m...

Page 91: ...s only when you are debugging your code and you want to print the mnemonic for each piece of status information c specifies that the status is returned after each programming message eliminating the n...

Page 92: ...error condition present count is the number of bytes transferred over the GPIB by the last rd wrt or cmd function Table 5 2 S Mode GPIB Status Conditions Returned by stat Numeric Value n Symbolic Valu...

Page 93: ...e CIC 2 ENOL Write detected no Listeners 3 EADR GPIB 232 485CT A not addressed correctly 4 EARG Invalid argument or arguments 5 ESAC Command requires GPIB 232 485CT A to be System Controller 6 EABO I...

Page 94: ...s programming message Status information is immediately returned indicating the current status conditions When you call stat with both s and n the numeric status is always returned first Notice that...

Page 95: ...C LACS CR LF 50 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 respons...

Page 96: ...ime of 10 seconds for I O operations and 1 10 of a second for serial poll responses timeio and timesp can also be 0 which disables either timeout accordingly Neither timeio nor timesp can contain comm...

Page 97: ...ect until you call tmo again call onl or turn off the GPIB 232 485CT A See Also rsp Example 1 PRINT 1 tmo 30 Set timeout for I O operations to 30 seconds Example 2 PRINT 1 tmo Print current timeout se...

Page 98: ...or spaces addrs are device addresses that specify the GPIB addresses you want to trigger If you call trg without an argument the EARG error is posted If this is the first function you call that requir...

Page 99: ...e GPIB 232 485CT A monitors GPIB activity When any event corresponding to the bits set in mask occurs the GPIB 232 485CT A returns status information indicating its current status If continuous status...

Page 100: ...485CT A waits indefinitely for the event to occur If you call wait without an argument the GPIB 232 485CT A records the EARG error See Also stat and tmo Table 5 5 Wait Mask Values Decimal Value Mnemon...

Page 101: ...before getting SRQI Go to an error routine at line 1000 IF STATUS AND H1000 0 THEN GOTO 200 If SRQI bit set go to routine to conduct a serial poll Example 2 PRINT 1 wait 4 Wait indefinitely to become...

Page 102: ...data string contains a CR or LF character The argument alist is a list of addrs separated by commas or spaces addrs specify the GPIB addresses of the Listeners Do not terminate the wrt programming mes...

Page 103: ...y 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 is recorded When performing the...

Page 104: ...the serial port If the argument boolrx is 1 and the GPIB 232 485CT A is receiving data over the serial port it sends XOFF over the serial port when its serial receive buffer is almost full This tells...

Page 105: ...t made by xon remains in effect until you call xon again call onl or turn off the GPIB 232 485CT A Example 1 PRINT 1 XON 1 1 Enable GPIB 232 485CT A XON XOFF protocol for TX and RX Example 2 PRINT 1 X...

Page 106: ...ion This means that it stores that information in its memory so that it is available when you request it The function descriptions also explain that the GPIB 232 485CT A returns certain information to...

Page 107: ...ext in the syntax description of each function Programming Messages You can program the GPIB 232 485CT A by sending it programming messages which are ASCII strings by way of its GPIB port Programming...

Page 108: ...n 8 CHR 13 CALL IBWRT GPIB232 WRT 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 e...

Page 109: ...ith secondary addressing disabled Address of the Serial Device The address of the serial device is the GPIB 232 485CT A primary address plus 1 with secondary addressing disabled However if you select...

Page 110: ...serial device talk address it sends data out to the GPIB that it has received from the serial device For example you might have your serial device programmed to perform some calculations and you want...

Page 111: ...Listener s knowing the number of transmission bytes in advance END and EOS can be used individually or in combination but the Listener must be configured to detect the end of a transmission END messag...

Page 112: ...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 the spign function Operation of the GPIB 232 485CT A as a GPIB D...

Page 113: ...port receive buffer is full or any byte is received from the attached serial device or the EOS byte is received from the attached serial device Parallel Polls The GPIB 232 485CT A sets the ist individ...

Page 114: ...ice Clear DCL command or when it receives its listen address and the Selected Device Clear SDC command it clears both its status buffer and its serial port receive buffer It also resets the GPIB seria...

Page 115: ...o the alphabetical list of functions at the end of this chapter or to Chapter 7 G Mode Functions The following are programming messages that are sent to the GPIB 232 485CT A from a GPIB Talker Table 6...

Page 116: ...used for general operations that are not provided by the GPIB functions or serial port functions id onl stat Alphabetical List of G Mode Functions Table 6 4 lists all of the G mode functions in alpha...

Page 117: ...5CT A User Manual 6 12 www ni com srqen mask Set conditions for asserting SRQ stat options Return GPIB 232 485CT A status xon modes Change serial port XON XOFF protocol Table 6 4 Alphabetical List of...

Page 118: ...e 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 informa...

Page 119: ...PIB 232 485CT A returns the current setting 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 2...

Page 120: ...s echo National Instruments Corporation 7 3 GPIB 232 485CT A User Manual Example 3 WRT echo CHR 13 What is the CALL IBWRT GPIB232 WRT current echo CALL IBRD GPIB232 RESP status RESP contains 0 CR LF c...

Page 121: ...enting a single ASCII character that is to be the EOS byte The arguments X and B are used to enable the corresponding EOS mode The argument D disables all EOS modes The three termination methods are s...

Page 122: ...rns the current eos settings The assignment made by this function remains in effect until you call eos again you call onl or you turn off the GPIB 232 485CT A See Also srqen and the GPIB Read and Writ...

Page 123: ...odel and software revision level 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 identifi...

Page 124: ...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...

Page 125: ...rror is indicated in the serial error code that is returned by the stat function The serial port errors include parity overrun framing and overflow errors Appendix C Status and Error Message Informati...

Page 126: ...s a character specifying the number of data bits 7 or 8 The argument stopbits is a character specifying the number of stop bits 1 or 2 If you call spset without an argument the GPIB 232 485CT A return...

Page 127: ...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 48...

Page 128: ...2 485CT A never asserts SRQ When the argument mask is 0 the GPIB 232 485CT A asserts SRQ under the conditions represented by each bit in the mask Table 7 2 describes the mask bits Table 7 2 SRQ Mask B...

Page 129: ...RR and 8 for SERR The power on default of srqen is disabled that is SRQ is never asserted If you call srqen without an argument the GPIB 232 485CT A returns a decimal string that indicates the decimal...

Page 130: ...y when you are debugging your code and you want to print the mnemonic for each piece of status information If you call stat without an argument continuous status reporting is disabled The status infor...

Page 131: ...al error condition present count is the number of bytes currently contained in the GPIB 232 485CT A serial port receive buffer Table 7 3 G Mode GPIB 232 485CT A Conditions Returned by stat Numeric Val...

Page 132: ...serial and GPIB error variables are updated whenever a new error occurs and are cleared automatically when status is reported Table 7 4 G Mode GPIB Error Conditions Returned by stat Numeric Value n S...

Page 133: ...00 Read up to 10 bytes of each piece of status 110 The GPIB 232 485CT A returns 4 pieces of 120 status We are set up to terminate 130 IBRD on linefeed which is what 140 terminates each piece of status...

Page 134: ...PRINT GPIB 232 485CT A status is RD Example 3 10 Turn on continuous status reporting 20 in symbolic format 30 WRT stat c s CHR 13 40 CALL IBWRT GPIB232 WRT 50 Read the GPIB 232 485CT A status read 50...

Page 135: ...ta over the serial port When boolrx is enabled as the GPIB 232 485CT A receives data over the serial port it sends XOFF over the serial port when its serial port receive buffer is almost full This tel...

Page 136: ...e by xon remains in effect until you call xon again call onl or turn off the GPIB 232 485CT A Example 1 WRT XON 1 1 CHR 13 Enable GPIB 232 485CT A CALL IBWRT GPIB232 WRT XON XOFF protocol for TX and R...

Page 137: ...EE 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 55 mA 220 240 VAC 45 mA Fuse rating and type 100 120 VAC 3...

Page 138: ...Version Operating temperature 10 to 40 C Storage temperature 0 to 70 C Relative humidity 10 to 95 noncondensing EMI FCC Class B Certified Physical Characteristics AC Version Overall case size dimensio...

Page 139: ...ital Interface for Programmable Instrumentation Table A 1 IEEE 488 Capability Codes for the GPIB 232 485CT A S Mode Code G Mode Code Description SH1 SH1 Source Handshake AH1 AH1 Acceptor Handshake T6...

Page 140: ...ons The multiline interface messages are commands defined by the IEEE 488 standard The messages are sent and received with ATN asserted The interface functions include initializing the bus addressing...

Page 141: ...ET 28 40 MLA8 09 9 HT TCT 29 41 MLA9 0A 10 LF 2A 42 MLA10 0B 11 VT 2B 43 MLA11 0C 12 FF 2C 44 MLA12 0D 13 CR 2D 45 MLA13 0E 14 SO 2E 46 MLA14 0F 15 SI 2F 47 MLA15 10 16 DLE 30 48 0 MLA16 11 17 DC1 LLO...

Page 142: ...A12 6C 108 l MSA12 PPE CFG12 4D 77 M MTA13 6D 109 m MSA13 PPE CFG13 4E 78 N MTA14 6E 110 n MSA14 PPE CFG14 4F 79 O MTA15 6F 111 o MSA15 PPE CFG15 50 80 P MTA16 70 112 p MSA16 PPD 51 81 Q MTA17 71 113...

Page 143: ...LO Local Lockout MLA My Listen Address MSA My Secondary Address MTA My Talk Address PPC Parallel Poll Configure PPD Parallel Poll Disable PPE Parallel Poll Enable PPU Parallel Poll Unconfigure SDC Sel...

Page 144: ...in status The number preceding each description is the numeric value of that bit in the status word ERR S or G mode 32768 The ERR bit is set in status following any call that results in an error The p...

Page 145: ...atus word whenever the SRQ line is asserted The bit is cleared whenever the GPIB SRQ line is unasserted CMPL S or G mode 256 The CMPL bit specifies that the operation relating to this status informati...

Page 146: ...ted TACS S mode 8 The TACS bit specifies whether the GPIB 232 485CT A has been addressed as a Talker The TACS bit is set whenever the GPIB 232 485CT A detects that its talk address and secondary addre...

Page 147: ...eared in status at the start of any subsequent programming message GPIB Error Codes When the ERR bit is set in status a GPIB error or a serial port error has occurred The error code is indicated by GP...

Page 148: ...either reduce the write byte count to that which is expected by the Controller or resolve the situation on the Controller s end This error also occurs during cmd if there is no device on the GPIB bus...

Page 149: ...erminates which programming message Use stat and check serial error to determine if a transmission error has occurred ESAC S mode 5 The GPIB 232 485CT A records this error when sic or sre is called wh...

Page 150: ...sp trg or wrt ECMD S or G mode 17 The GPIB 232 485CT A records this error when your programming message received does not contain a recognizable function name This error can happen if the function nam...

Page 151: ...erial port settings EOFL 3 The GPIB 232 485CT A records this error when the GPIB 232 485CT A s internal serial port buffer overflows This error should only occur if XON XOFF is disabled and no hardwar...

Page 152: ...Terminating Equipment Employing Serial Binary Data Interchange standardizes serial communication between computers and between computer terminals and modems Most applications use the RS 232 standard...

Page 153: ...nfiguration Pin Number Signal Description RS 232 Code Function 2 RXD Receive Data BB This signal carries serial data from the serial device to the GPIB 232CT A 3 TXD Transmit Data BA This signal carri...

Page 154: ...tup no transmissions could occur Thus these applications must use a cabling scheme that connects the transmitter on one device to the receiver on the other device and vice versa This method is known a...

Page 155: ...including the hardware handshake lines RTS CTS and DTR With this configuration the GPIB 232CT A can function properly handshake on Table D 2 Cable Wiring Scheme for GPIB 232CT A DTE to Serial Device D...

Page 156: ...PIB 232CT A to a DCE without Handshaking If your serial device does not require or use the hardware handshaking protocol used by the GPIB 232CT A you have two options Use a minimum configuration cable...

Page 157: ...the DCE does not require external hardware handshaking The minimum configuration for a DTE 9 pin to DCE 9 pin cable is shown in Figure D 6 Figure D 7 shows an equivalent 9 pin to 25 pin cable Figure D...

Page 158: ...ed it is best to use some form of handshaking to prevent loss of data Interfacing the GPIB 232CT A to a DTE with Handshaking For serial devices set up as DTEs you must wire a DTE to DTE interface cabl...

Page 159: ...Handshaking Interfacing the GPIB 232CT A to a DTE without Handshaking If your serial device does not require or use the same hardware handshaking protocol used by the GPIB 232CT A you have two options...

Page 160: ...hat the serial device does not require external hardware handshaking The minimum configuration for a 9 pin to 9 pin null modem cable is shown in Figure D 10 Figure D 11 shows an equivalent 9 pin to 25...

Page 161: ...232 characteristics of your serial device and build the cable to properly connect the handshake lines of the two devices If the documentation for your serial device does not provide a thorough explan...

Page 162: ...lanced Voltage Digital Interface Circuits defines a serial interface much like RS 232 However RS 422 uses balanced or differential transmission lines Balanced transmission lines use two transmission l...

Page 163: ...sses the issue of using multiple transmitters on the same line RS 485 defines the electrical characteristics necessary to ensure adequate signal voltages under maximum load short circuit protection an...

Page 164: ...is full 4 RXD Receive Data Non inverting This signal combined with RXD carries data from the serial device to the GPIB 485CT A 5 RXD Receive Data Inverting This signal combined with RXD carries data...

Page 165: ...d it is best to implement some form of handshaking to prevent loss of data Termination Because each differential pair of wires is a transmission line you must properly terminate the line to prevent re...

Page 166: ...5CT A User Manual RS 485 termination connector that contains embedded terminating resistors for easy termination Figure E 2 shows a full duplex system with termination Figure E 2 Point to Point Networ...

Page 167: ...byte s and above The bus supports one System Controller usually a computer and up to 14 additional instruments The ANSI IEEE Standard 488 2 1992 extends IEEE 488 1 by defining a bus communication prot...

Page 168: ...ching center Controller monitors the communications network GPIB When the center Controller notices that a party device wants to make a call send a data message it connects the caller Talker to the re...

Page 169: ...ne Controller at a time is active or Controller In Charge CIC Active control can be passed from the current CIC to an idle Controller Only one device on the bus the System Controller can make itself t...

Page 170: ...nsfer of message bytes among devices The process is called a three wire interlocked handshake and it guarantees that message bytes on the data lines are sent and received without transmission error NR...

Page 171: ...rce Handshake 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 com...

Page 172: ...d F 3 or a combination of the two The standard connector is the Amphenol or Cinch Series 57 Microribbon or Amp Champ type An adapter cable using a non standard cable and or connector is used for speci...

Page 173: ...nd the number of devices on the bus Bus extenders are available from National Instruments if you need to overcome these limitations Use the following guidelines A maximum separation of 4 m between any...

Page 174: ...a carriage return CR and linefeed LF LINE INPUT allows you to read each piece of status information easily and assign it to a variable Use INPUT to read a data string from your GPIB device INPUT requ...

Page 175: ...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: ...eceives it The GPIB 232 485CT A is powered on and its READY LED is on Switch 1 of the DIP switch must be ON for G mode and switches 2 and 3 must be OFF If you must change these switch settings be sure...

Page 177: ...configured for parallel polls responds at this time by driving an assigned data line either TRUE or FALSE depending on the value of its individual status ist bit When a parallel poll is conducted the...

Page 178: ...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 T...

Page 179: ...ing programming message to the GPIB 232 485CT A ppc 5 3 1 CR Figure H 2 shows the PPE message that is formed by the ppc programming message given above Figure H 2 Sample PPE Message Bits The value of...

Page 180: ...send PPD messages to every device on the GPIB For the ppc or ppu function to have an effect the device that it is configuring must be using PP subset PP1 If the device is not using PP subset PP1 then...

Page 181: ...d clears it whenever it unasserts SRQ Refer to the srqen function description in Chapter 7 G Mode Functions for the conditions under which the GPIB 232 485CT A asserts SRQ If the Controller remotely c...

Page 182: ...parallel poll is conducted by calling rpp one of two things happens If the scanner is free it asserts DIO line 4 rpp returns hex 8 if it is busy it unasserts DIO line 4 rpp returns hex 0 When the sca...

Page 183: ...s When a parallel poll is conducted by calling rpp the PC can immediately find out if any printer is busy or if all printers are free If all line printers are free rpp returns hex 0 or hex 8 if the sc...

Page 184: ...ndence by reconfiguring the line printers with the following programming message ppc 1 5 0 2 5 0 3 5 0 CR This programming message causes a PPE message of hex 68 to be sent to each of the line printer...

Page 185: ...rial port settings 2 Send the stat function to have status information returned to you after your programming message 3 Send GPIB initialization functions if you need to change default GPIB settings 4...

Page 186: ...ure I 1 Sample Switch Settings for a Terminal and HP Plotter 3 Connect the serial cable to the serial port of the terminal and to the GPIB 232 485CT A 4 Connect the GPIB cable to the GPIB port on your...

Page 187: ...evious programming message This status reports CMPL and no errors Step 3 Send the GPIB Initialization Functions Determine what GPIB initialization functions are needed to change default settings If yo...

Page 188: ...CR CMPL CIC TACS NGER NSER 29 wrt CR SC 100 100 100 100 PA0 0 CI40 CR CMPL CIC TACS NGER NSER 31 Using an HP 7475A Plotter with an IBM PC This example shows how to write a program on an IBM PC using...

Page 189: ...g or writing to the serial port a device must be opened Place the following BASIC statement at the beginning of your program to open and configure the serial port COM1 and name it device 1 OPEN COM1 9...

Page 190: ...T 1 stat c n GOSUB status PRINT 1 wrt 5 PRINT 1 in sp1 pa1000 3000 ci500 GOSUB status END status STAT VAL LINE INPUT 1 status LINE INPUT 1 gpiberr LINE INPUT 1 sperr LINE INPUT 1 cnt PRINT status gpib...

Page 191: ...ations of the general programming steps along with sample programs The examples use NI 488 2 functions to perform the GPIB operations To communicate with the GPIB 232 485CT A send information to it us...

Page 192: ...you read or write from the plotter You accomplish this during the programming steps 2 Connect the GPIB cable to the GPIB port on your computer and to the GPIB 232 485CT A 3 Connect the serial cable t...

Page 193: ...PIBCT 15 CALL IBFIND GCT GPIBCT Open GPIB 232 485CT A 20 GPIBCT is a GPIB device 25 configured in ibconf to have 30 primary address 35 SDNAME PLOTTER 40 CALL IBFIND SDNAME PLOTTER Open PLOTTER 45 PLOT...

Page 194: ...s example demonstrates how to control a serial printer on the GPIB The printer is the Apple Imagewriter The Controller is an IBM PC with an AT GPIB interface installed The following program example pr...

Page 195: ...te of the printer and the GPIB 232 485CT A are both 9600 there is no need to initialize the software of the serial port Step 4 Communicate with the Printer Before communicating with the printer send t...

Page 196: ...T A User Manual I 12 www ni com 100 a minus sign then go to 105 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 PRI...

Page 197: ...ons FAQs and their corresponding answers or solutions including special sections devoted to our newest products The database is updated daily in response to new customer experiences and feedback Troub...

Page 198: ...to provide information on local services You can access these Web sites from www ni com worldwide If you have trouble connecting to our Web site please contact your local National Instruments office o...

Page 199: ...m milli 10 3 k kilo 103 M mega 106 Symbols degrees percent ohms A A amperes AC alternating current ANSI American National Standards Institute ASCII American Standard Code for Information Interchange...

Page 200: ...DCL Device Clear DIO digital input output DIP dual inline package DTAS Device Trigger Active State DTE Data Terminal Equipment DTR Data Terminal Ready E EIA Electronic Industries Association EOI end o...

Page 201: ...ernational Electrotechnical Commission IEEE Institute of Electrical and Electronic Engineers IFC Interface Clear in inches I O input output ISO International Standards Organization IST Individual Stat...

Page 202: ...Poll Enable R RAM random access memory REM Remote REN Remote Enable ROM read only memory RQS Request Service RTS Request to Send RXD Receive Data S s seconds SRQ Service Request SRQI Service Request...

Page 203: ...Glossary National Instruments Corporation Glossary 5 GPIB 232 485CT A User Manual U UL Underwriters Laboratories V V volts VAC volts alternating current VDC volts direct current...

Page 204: ...s bit C 3 clr function 5 6 cmd function 5 7 to 5 8 CMPL status bit C 2 commands or command messages See also cmd function definition F 1 multiline interface messages B 1 to B 4 common questions G mode...

Page 205: ...iguration for 9 pin DTE to 9 pin DCE figure D 5 cable configuration for 9 pin DTE to 25 pin DCE figure D 5 cable wiring scheme table D 4 interfacing without handshaking D 5 to D 7 custom cables D 7 mi...

Page 206: ...mode programming 4 6 eos function G mode 7 4 to 7 5 S mode 5 12 to 5 14 eot function 5 15 to 5 16 EPAR error code C 8 ERR status bit C 1 error codes GPIB C 4 to C 7 EABO C 6 EADR C 5 EARG C 6 EBUS C 7...

Page 207: ...ctions GPIB characteristics table 6 10 serial port characteristics table 6 10 error handling 6 1 function arguments 6 3 to 6 6 general programming steps H 6 to H 7 GPIB read and write termination meth...

Page 208: ...EARG C 6 EBUS C 7 ECAP C 7 ECIC C 4 to C 5 ECMD C 7 ENOL C 5 ESAC C 6 NGER C 4 GPIB error conditions returned by stat function table G mode 7 15 S mode 5 46 GPIB functions G mode eos 7 4 to 7 5 list o...

Page 209: ...function 5 23 to 5 24 trg function 5 51 I id function G mode 7 6 S mode 5 19 IEEE capability codes table A 3 IFC interface Clear line F 5 initialization functions See GPIB initialization functions ins...

Page 210: ...list of S mode functions 4 8 ppc 5 27 to 5 28 ppu 5 29 to 5 30 rpp 5 33 parallel polling H 1 to H 8 conducting H 5 configuration H 2 to H 4 issuing local configurations in S mode H 4 issuing remote co...

Page 211: ...able E 3 rsc function 5 34 to 5 35 rsp function 5 36 to 5 37 rsv function 5 38 RTS HSO signal RS 485 port table E 3 RTS HSO signal RS 485 port table E 3 RTS signal RS 232 port table D 2 RXD signal RS...

Page 212: ...mmon questions G 1 to G 2 conventions and considerations 4 2 default settings and related functions GPIB characteristics table 4 7 serial port characteristics table 4 6 error handling 4 1 function arg...

Page 213: ...g 6 7 service request conditions SRQ 6 8 sic function 5 39 to 5 40 side panels GPIB connector 1 8 signals and lines GPIB data lines F 4 handshake lines F 4 to F 5 interface management lines F 5 softwa...

Page 214: ...settings 3 5 to 3 6 serial mode baud rate table 3 4 System Controller F 3 T TACS status bit C 3 Take Control TCT command 6 9 TALK LED table 1 4 Talker addressing GPIB 232 485CT A and serial device as...

Reviews: