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 SCG unit 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;SWITCH 1 1 1"
' change channel
' More code executed while switch channel 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 SCG
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 learn query command
PRINT #1, "ENTER 07"
LINE INPUT #2, LEARN$
' The above variables can be saved in a data file before quitting the program and
' later read back to restore the SCG unit to a same state.
' Like this...
PRINT#1, "OUTPUT 07;"LEARN$
' SCG settings are now restored
END
RS232C Programming Examples
This section provides programming examples for controlling the SCG unit over the RS232C
interface. The samples are written in MS-DOS Qbasic and run on a personal computer
equipped with a serial port. COM port 2 of the computer is designated as the serial port and is
connected to the SCG unit.
The RS232C commands that appear in this section do not always show the terminating
character <CR>; however, it is implied.
Programming Guide –
33
Содержание SCG Series
Страница 1: ...SCG SERIES FIBEROPTIC SWITCH User s Manual...