HP SB manual Sending Commands, Serial Polling the Status Register

Page 36

equipped with a National Instruments3 GPIB interface board, with National Instruments Universal Language Interface drivers loaded. The commands that control the GPIB are similar to Hewlett Packard4 HP Basic commands. Most other controller board manufacturers provide basic output and input statements for communicating messages to a GPIB instrument.

Before using any of these samples, ensure that the GPIB address is set to 7, the interface command set is SB, the ULI.EXE driver is loaded, and the switch is connected to the computer via a GPIB cable.

The GPIB commands provided in this section do not always show the terminating sequence <CR><LF>; however, it is implied.

Sending Commands

This example sets the SB switch to channel 6 and turns on all the external relay drivers.

'set up the interface card and drivers OPEN "GPIB0" FOR OUTPUT AS #1 OPEN "GPIB0" FOR INPUT AS #2 PRINT #1, "ABORT"

'set terminating character to CR LF sequence PRINT #1, "GPIBEOS OUT CR LF"

PRINT #1, "GPIBEOS IN CR LF"

'sample commands"close 6; xdrs255"

PRINT #1, "OUTPUT 07;CLOSE 6;XDRS 255" ' sample queries

PRINT #1, "OUTPUT 07;CLOSE?" PRINT #1, "ENTER 07"

INPUT #2, a PRINT "channel ",a

PRINT #1, "OUTPUT 07;XDRS?" PRINT #1, "ENTER 07"

INPUT #2, a

PRINT "driver state ",a

END

Serial Polling the Status Register

This example changes the channel setting and reads the status register continuously until the output has settled.

PRINT #1, "OUTPUT 07;csb"

' clearing the status byte clears the settling

bit

 

PRINT #1, "OUTPUT 07;CLOSE 12"

' change channel

sr = 0

' initialize sr variable to enter the while loop

WHILE ((sr AND 4 ) =0)

' loop until settled bit is true

PRINT #1, "SPOLL 07"

' serial poll SB switch

INPUT #2, sr

 

3National Instruments is a trademark of National Instruments.

4Hewlett Packard is a registered trademark of Hewlett-Packard Co.

Programming Guide – 31

Image 36
Contents SB Series Fiberoptic Switch User’s ManualPage Contents Programming Guide SD000153 Rev. J May Safety Information, Instructions, and Symbols Safety InformationSafety Instructions Before Initializing and Operating the UnitOperating the Unit Safety Safety Symbols SymbolProceeding Compliance CE ComplianceGeneral Information and Specifications Single-Common SB-C Switch ConfigurationGeneral Information Dual-Common SB-D Switch Configuration Single Step Dual Common SB-E Switch ConfigurationDual-Common Blocking SB-F Switch Configuration Key FeaturesStandard Accessories Optional AccessoriesSpecifications Parameter Typical MaximumElectrical PhysicalEnvironmental Getting Started Before Initializing and Operating the UnitInitial Inspection Operating EnvironmentStoring and Shipping Cleaning Connectors Installing the Switch Connector Cleaning connector type can varyOperating and Maintenance Instructions Front PanelOperating Keys Key DescriptionExternal Switch Module Connections External Switch Module without TTL Input ControlsRear Panel External Switch Module with TTL Input Controls Sample Driver Application Electrical Equivalent of DriverPowering Up the Switch Using and Selecting a ChannelSetting the Gpib Address Setting the Interface Command Set for SC and SX SwitchesControlling the Drivers Controlling the Switch Locally Controlling the Switch Remotely by Gpib InterfaceControlling the Switch Remotely by RS232 Interface Calibrating the Switch Maintaining the SwitchPrint #1, CLOSE? Input #1,A$ Print A$ END Operating and Maintenance Instructions Programming Guide Gpib Pin AssignmentRS232 Interface Specifications Gpib Interface FunctionsRS232 Pin Assignment Mnemonic FunctionOperation and Query Commands Name Symbol Pin Number Signal DirectionCommand Parser Rules RS232 Driver Pin AssignmentOperation Commands ResetClose Set Optical Channel XDR i k Driver ControlQuery Commands Error Number Last Number ErrorDrivers LearnStatus Reporting and Service Request Control Condition RegisterStatus Register Gpib Programming Examples SRQ Mask RegisterSRQ Mask Register Bit Sending Commands Serial Polling the Status RegisterGenerating a Service Request Interrupt RS232 Programming ExamplesLearn Query LRN? Setting the Interface Command Set Querying StatusReading the Status Register SC Series Switch Command Set SCXXX-0XXX Models SX Series Switch Command SetSyntax Function Bit MessageRQS Busy Normal BAD Data Unit Failure