equipped with a serial port. COM port 2 of the computer is designated as the serial port and is connected to the switch.

Before using any of these examples, ensure that the active interface command set is SB.

The RS232 interface cannot receive an SRQ interrupt.

The RS232C commands that appear in this section do not always show the terminating character <CR>; however, it is implied.

Sending Commands

OPEN "COM2:1200,N,8,1" FOR RANDOM AS #3

A = 10

PRINT#3, "CLOSE ";A

PRINT#3, "XDRS 255"

END

Querying Status

This example queries and displays the current channel setting.

PRINT#3, "CLOSE?"

INPUT#3, A

PRINT A

END

Reading the Status Register

The serial polling function is not supported on any RS232 interface, but STB? can be used to query the status register since the query command performs the same function as serial polling.

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

OPEN "COM2:1200,N,8,1" FOR RANDOM AS #3

 

PRINT#3, "CSB"

' clear status register

PRINT#3, "CLOSE 5"

 

DO

' loop until motor settles

PRINT#3, "STB?"

 

INPUT#3, SR1

 

LOOP UNTIL (SR1 AND 4)

 

PRINT SR1

 

END

 

Setting the Interface Command Set

The SB switch can be set to emulate the interface command sets of earlier models of JDS Uniphase SC Series and SX Series switches.

Programming Guide – 33

Page 38
Image 38
HP SB manual Setting the Interface Command Set, Querying Status, Reading the Status Register