DECLARE SUB pen1
DECLARE SUB pen2
DECLARE SUB pen3
DECLARE SUB pen4
DECLARE SUB pen5
DECLARE SUB pen6
DECLARE SUB pen7
DECLARE SUB pen8
DECLARE SUB pen9
DECLARE SUB pen10
DECLARE SUB pen11
DECLARE SUB pen12
DECLARE SUB pen13
DECLARE SUB pen14
DECLARE SUB pen15
DECLARE SUB pen16
DECLARE SUB pen17
DECLARE SUB ready
DECLARE SUB status
DECLARE SUB P378
DECLARE SUB P3BC
DECLARE SUB P278
DIM Timer1 AS QTIMER
DIM port AS INTEGER
CREATE Form AS QFORM
CAPTION = "LPTport for Windows"
Width = 271
Height = 387
Center
CREATE Label1 AS QLABEL
CAPTION = "OUTPUTS"
Left = 21
Top = 10
Width = 52
Transparent = 1
END CREATE
CREATE Label2 AS QLABEL
CAPTION = "LPT PORT"
Left = 142
Top = 10
Width = 52
Transparent = 1
END CREATE
CREATE Label3 AS QLABEL
CAPTION = "INPUTS"
Left = 142
Top = 130
Width = 42
Transparent = 1
END CREATE
CREATE RadioButton2 AS QRADIOBUTTON
CAPTION = "LP&T2 - H3BC"
OnClick= P3BC
Left = 142
Top = 70
TabOrder = 1
END CREATE
CREATE CheckBox1 AS QCHECKBOX
CAPTION = "D&0 - pen 2"
OnClick = pen2
Left = 21
Top = 49
TabOrder = 3
END CREATE
CREATE CheckBox2 AS QCHECKBOX
CAPTION = "D&1 - pen 3"
OnClick = pen3
Left = 21
Top = 72
TabOrder = 4
END CREATE
CREATE CheckBox3 AS QCHECKBOX
CAPTION = "D&2 - pen 4"
OnClick = pen4
Left = 21
Top = 95
TabOrder = 5
END CREATE
CREATE CheckBox4 AS QCHECKBOX
CAPTION = "D&3 - pen 5"
OnClick = pen5
Left = 21
Top = 118
TabOrder = 6
END CREATE
CREATE CheckBox5 AS QCHECKBOX
CAPTION = "D&4 - pen 6"
OnClick = pen6
Left = 21
Top = 143
TabOrder = 7
END CREATE
CREATE CheckBox6 AS QCHECKBOX
CAPTION = "D&5 - pen 7"
OnClick = pen7
Left = 21
Top = 167
TabOrder = 8
END CREATE
CREATE CheckBox7 AS QCHECKBOX
CAPTION = "D&6 - pen 8"
OnClick = pen8
Left = 21
Top = 191
TabOrder = 9
END CREATE
CREATE CheckBox8 AS QCHECKBOX
CAPTION = "D&7 - pen 9"
OnClick = pen9
Left = 21
Top = 216
TabOrder = 10
END CREATE
CREATE CheckBox9 AS QCHECKBOX
CAPTION = "&Strobe - pen 1"
OnClick = pen1
Left = 21
Top = 252
TabOrder = 11
END CREATE
CREATE CheckBox10 AS QCHECKBOX
CAPTION = "&Auto F - pen 14"
OnClick = pen14
Left = 21
Top = 275
TabOrder = 12
END CREATE
CREATE CheckBox11 AS QCHECKBOX
CAPTION = "&Init - pen 16"
OnClick = pen16
Left = 21
Top = 297
TabOrder = 13
END CREATE
CREATE CheckBox12 AS QCHECKBOX
CAPTION = "Sel I&n - pen 17"
OnClick = pen17
Left = 21
Top = 322
TabOrder = 14
END CREATE
CREATE CheckBox13 AS QCHECKBOX
CAPTION = "C Error - pen 15"
Left = 142
Top = 168
TabOrder = 15
END CREATE
CREATE CheckBox14 AS QCHECKBOX
CAPTION = "C Sel - pen 13"
Left = 142
Top = 191
TabOrder = 16
END CREATE
CREATE CheckBox15 AS QCHECKBOX
CAPTION = "C Pe - pen 12"
Left = 142
Top = 214
TabOrder = 17
END CREATE
CREATE CheckBox16 AS QCHECKBOX
CAPTION = "C Ack - pen 10"
Left = 142
Top = 238
TabOrder = 18
END CREATE
CREATE Button1 AS QBUTTON
CAPTION = "&Ready"
OnClick = ready
Left = 142
Top = 316
TabOrder = 19
END CREATE
CREATE RadioButton3 AS QRADIOBUTTON
CAPTION = "LPT3 - &H278"
OnClick= P278
Left = 142
Top = 94
TabOrder = 2
END CREATE
CREATE RadioButton1 AS QRADIOBUTTON
CAPTION = "&LPT1 - H378"
OnClick= P378
Left = 142
Top = 46
END CREATE
CREATE CheckBox17 AS QCHECKBOX
CAPTION = "C Busy - pen 11"
Left = 142
Top = 264
TabOrder = 20
END CREATE
END CREATE
SUB pen1
IF CheckBox9.Checked THEN
OUT port+2, (INP(port+2) AND 254)
ELSE
OUT port+2, (INP(port+2) OR 1)
END IF
END SUB
SUB pen14
IF CheckBox10.Checked THEN
OUT port+2, (INP(port+2) AND 253)
ELSE
OUT port+2, (INP(port+2) OR 2)
END IF
END SUB
SUB pen16
IF CheckBox11.Checked THEN
OUT port+2, (INP(port+2) OR 4)
ELSE
OUT port+2, (INP(port+2) AND 251)
END IF
END SUB
SUB pen17
IF CheckBox12.Checked THEN
OUT port+2, (INP(port+2) AND 247)
ELSE
OUT port+2, (INP(port+2) OR 8)
END IF
END SUB
SUB pen2
IF CheckBox1.Checked THEN
OUT port, (INP(port) OR 1)
ELSE
OUT port, (INP(port) AND 254)
END IF
END SUB
SUB pen3
IF CheckBox2.Checked THEN
OUT port, (INP(port) OR 2)
ELSE
OUT port, (INP(port) AND 253)
END IF
END SUB
SUB pen4
IF CheckBox3.Checked THEN
OUT port, (INP(port) OR 4)
ELSE
OUT port, (INP(port) AND 251)
END IF
END SUB
SUB pen5
IF CheckBox4.Checked THEN
OUT port, (INP(port) OR 8)
ELSE
OUT port, (INP(port) AND 247)
END IF
END SUB
SUB pen6
IF CheckBox5.Checked THEN
OUT port, (INP(port) OR 16)
ELSE
OUT port, (INP(port) AND 255-16)
END IF
END SUB
SUB pen7
IF CheckBox6.Checked THEN
OUT port, (INP(port) OR 32)
ELSE
OUT port, (INP(port) AND 255-32)
END IF
END SUB
SUB pen8
IF CheckBox7.Checked THEN
OUT port, (INP(port) OR 64)
ELSE
OUT port, (INP(port) AND 255-64)
END IF
END SUB
SUB pen9
IF CheckBox8.Checked THEN
OUT port, (INP(port) OR 128)
ELSE
OUT port, (INP(port) AND 255-128)
END IF
END SUB
SUB P378
port=&H378
status
END SUB
SUB P3BC
port=&H3BC
status
END SUB
SUB P278
port=&H278
status
END SUB
SUB ready
Form.CLOSE
END SUB
SUB status
CheckBox1.Checked=((INP(port) AND 1)/1)
CheckBox2.Checked=((INP(port) AND 2)/2)
CheckBox3.Checked=((INP(port) AND 4)/4)
CheckBox4.Checked=((INP(port) AND 8)/8)
CheckBox5.Checked=((INP(port) AND 16)/16)
CheckBox6.Checked=((INP(port) AND 32)/32)
CheckBox7.Checked=((INP(port) AND 64)/64)
CheckBox8.Checked=((INP(port) AND 128)/128)
CheckBox13.Checked=((INP(port+1) AND 8)/8)
CheckBox14.Checked=((INP(port+1) AND 16)/16)
CheckBox15.Checked=((INP(port+1) AND 32)/32)
CheckBox16.Checked=((INP(port+1) AND 64)/64)
CheckBox17.Checked=(1-((INP(port+1) AND 128)/128))
CheckBox9.Checked=(1-(INP(port+2) AND 1)/1)
CheckBox10.Checked=(1-(INP(port+2) AND 2)/2)
CheckBox11.Checked=((INP(port+2) AND 4)/4)
CheckBox12.Checked=(1-(INP(port+2) AND 8)/8)
END SUB
SUB TimerOver
Timer1.Interval = 400
status
END SUB
port=&H378
RadioButton1.Checked=1
Timer1.Interval = 400
Timer1.Enabled = 1
Timer1.OnTimer = TimerOver
Form.SHOWMODAL
|