20
Programming Examples
Run this sample program to select available channels for the SK switch to be controlled through
a PC printer port. See the
1 REM TESTING PROGRAM FOR SK SWITCH THROUGH A PC PRINTER PORT
2 REM OUTPUT DATA PINS ARE AS FOLLOWS:
3 REM (ADDRESS 378H) BIT0-BIT6 CORRESPOND TO DATA0-DATA6
4 REM (ADDRESS 37AH) BIT7=Busy, BIT2=Error
10 DIM SHARED KEYPRESS AS STRING
20 I = 0 'SET CHANNEL TO 0
30 OUT &H378, I + 128 'OUTPUT THE CHANNEL SELECTION
40 OUT &H37A, 1 'SET STROBE LOW
50 OUT &H37A, 0 'SET STROBE HIGH
60 CLS 'CLEAR THE USER SCREEN
62 LOCATE 6, 23
64 PRINT "JDS Uniphase - SK SWITCH TEST"
66 LOCATE 11, 23
68 PRINT "PRESS I TO INCREMENT CHANNEL"
70 LOCATE 12, 23
72 PRINT "PRESS D TO DECREMENT CHANNEL"
74 LOCATE 13, 23
76 PRINT "PRESS R TO Reset AND TEST CHANNEL POSITION"
78 LOCATE 14, 23
80 PRINT "PRESS Q TO QUIT"
82 LOCATE 20, 23
84 PRINT " "
86 LOCATE 20, 23
88 PRINT "CHANNEL"; I 'DISPLAY CURRENT CHANNEL
100 STATUS = INP(&H379) 'CHECK SWITCH STATUS
110 IF (STATUS AND 8) THEN 'CHECK FOR ERROR
120 LOCATE 22, 23 'DECLARE POSITION ERROR
130 PRINT "POSITION Error DETECTED!"
140 ELSE
150 LOCATE 22, 23
160 PRINT " " 'CLEAR POS. ERROR STATEMENT
170 END IF
180 STATUS = INP(&H379) 'CHECK SWITCH STATUS
190 IF (STATUS AND 128) <> 128 THEN GOTO 180 'WAIT FOR BUSY BIT TO CLEAR
200 KEYPRESS = INKEY$ 'CHECK FOR KEYBOARD SELECTION
210 IF KEYPRESS = "Q" THEN GOTO 1000
220 IF KEYPRESS = "I" THEN I = I + 1
230 IF KEYPRESS = "D" THEN I = I - 1
240 IF KEYPRESS = "R" THEN
250 OUT &H378, I 'OUTPUT THE CHANNEL AND RESET
260 ELSE
270 OUT &H378, I + 128 'OUTPUT THE CHANNEL SELECTION
280 END IF
300 IF KEYPRESS <> "" THEN
310 OUT &H37A, 1 'SET THE STROBE LINE LOW
320 OUT &H37A, 0 'SET THE STROBE LINE HIGH
340 END IF
500 GOTO 82
1000 STOP
Summary of Contents for SK Series
Page 1: ...SK SERIES FIBEROPTIC SWITCH MODULE User s Manual...
Page 2: ...ii SD000166 Rev 501 June 2003 2003 JDS Uniphase All rights reserved...
Page 4: ...iv...
Page 18: ...12...
Page 24: ...18...