HP SB manual RS232 Programming Examples, Generating a Service Request Interrupt, Learn Query LRN?

Page 37

WEND

PRINT sr' print final value of sr

END

Generating a Service Request Interrupt

This example tests the service request interrupt function. It unmasks the settled bit in the SRQ mask register and selects a channel. An interrupt is generated when the switch reaches the channel.

ON PEN GOSUB SPOLL

' enable SRQ interrupt

PEN ON

 

PRINT #1, "OUTPUT 07;CSB;SRE 4"

' clear status register and unmask

 

' settled bit in SRQ mask register

PRINT #1 "OUTPUT 07;CLOSE 6"

' change channel

'More code executed while switch hannelc set

WHILE (INKEY$ = "")

' endless loop to simulate bigger program

WEND

' ends when any key is pressed

PEN OFF

 

END

 

SPOLL:

 

PRINT #1, "SPOLL 07"

' serial poll the switch

INPUT #2, sr

' read status register

PRINT sr

' verify SRQ bit is set

PRINT #1, "SPOLL 07"

' serial poll again to verify SRQ bit is now cleared

INPUT #2, sr

' read status register

PRINT sr

 

RETURN

 

Learn Query (LRN?)

This example demonstrates the use of the learn query.

DIM LEARN$[100]

PRINT #1, "OUTPUT 07;LRN?"' send the learnquery command PRINT #1, "ENTER 07"

LINE INPUT #2, LEARN$

'The above variables can be saved in a datailef before quitting the program and

'then later readback and used to restore the switch to a same state.

'Like this...

PRINT#1, "OUTPUT 07;"LEARN$

'SB settings are now restored

END

RS232 Programming Examples

This section provides programming examples for controlling the SB switch over the RS232 interface. The examples were written in MS-DOS Qbasic and run on a personal computer

Programming Guide – 32

Image 37 Contents
User’s Manual SB Series Fiberoptic SwitchPage Contents Programming Guide SD000153 Rev. J May Safety Information Safety Information, Instructions, and SymbolsBefore Initializing and Operating the Unit Safety InstructionsOperating the Unit Safety Symbol Safety SymbolsProceeding CE Compliance ComplianceSingle-Common SB-C Switch Configuration General Information and SpecificationsGeneral Information Single Step Dual Common SB-E Switch Configuration Dual-Common SB-D Switch ConfigurationKey Features Dual-Common Blocking SB-F Switch ConfigurationStandard Accessories Optional AccessoriesParameter Typical Maximum SpecificationsPhysical ElectricalEnvironmental Before Initializing and Operating the Unit Getting StartedInitial Inspection Operating EnvironmentStoring and Shipping Cleaning Connectors Connector Cleaning connector type can vary Installing the SwitchFront Panel Operating and Maintenance InstructionsOperating Keys Key DescriptionExternal Switch Module without TTL Input Controls External Switch Module ConnectionsRear Panel Sample Driver Application Electrical Equivalent of Driver External Switch Module with TTL Input ControlsUsing and Selecting a Channel Powering Up the SwitchSetting the Interface Command Set for SC and SX Switches Setting the Gpib AddressControlling the Drivers Controlling the Switch Remotely by Gpib Interface Controlling the Switch LocallyControlling the Switch Remotely by RS232 Interface Maintaining the Switch Calibrating the SwitchPrint #1, CLOSE? Input #1,A$ Print A$ END Operating and Maintenance Instructions Gpib Pin Assignment Programming GuideGpib Interface Functions RS232 Interface SpecificationsRS232 Pin Assignment Mnemonic FunctionName Symbol Pin Number Signal Direction Operation and Query CommandsCommand Parser Rules RS232 Driver Pin AssignmentReset Operation CommandsClose Set Optical Channel XDR i k Driver ControlQuery Commands Last Number Error Error Number Drivers LearnCondition Register Status Reporting and Service Request ControlStatus Register SRQ Mask Register Gpib Programming ExamplesSRQ Mask Register Bit Serial Polling the Status Register Sending CommandsRS232 Programming Examples Generating a Service Request InterruptLearn Query LRN? Querying Status Setting the Interface Command SetReading the Status Register SX Series Switch Command Set SC Series Switch Command Set SCXXX-0XXX ModelsSyntax Function Bit MessageRQS Busy Normal BAD Data Unit Failure