Guidance
指路人
g.yi.org
software / rapidq / Examples / Devices / Printer & Parallel Port / BitBox / BitBox.BAS

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'BitBox für den LPT Port   @ -=I3I2UI\I0=-  0.9.71
'(getestet auf 98SE & ME)
'
'Die Bits des Daten- und Controlregister können durch anklicken
'gesetzt (on) oder gelöscht (off) werden. Statusregister ist read only.
'Die Anzeige entspricht dem logischen Zustand der Register
'nicht dem Spannungszustand an den PINs des LPT - Port.
'-----------------------------------------------------
'
'Benutzung des Programms natürlich auf eigene Gefahr!!!!!
'--------------------------------------------------------
'
'Programmiert mit Rapid-Q -Freeware- www.basicguru.com/rapidq
'Portzugriffe mit inpout32.dll -Freeware- www.logix4u.net


'DB25 Signal name Direction Register - bit Inverted
' 1   nStrobe          Out   Control-0  Yes
' 2   Data0          In/Out  Data-0     No
' 3   Data1          In/Out  Data-1     No
' 4   Data2          In/Out  Data-2     No
' 5   Data3          In/Out  Data-3     No
' 6   Data4          In/Out  Data-4     No
' 7   Data5          In/Out  Data-5     No
' 8   Data6          In/Out  Data-6     No
' 9   Data7          In/Out  Data-7     No
'10   nAck             In    Status-6   No
'11   Busy             In    Status-7   Yes
'12   Paper-Out        In    Status-5   No
'13   Select           In    Status-4   No
'14   Linefeed         Out   Control-1  Yes
'15   nError           In    Status-3   No
'16   nInitialize      Out   Control-2  No
'17   nSelect-Printer  Out   Control-3  Yes
'18-25 Ground           -     -         -

'** Quelltext**
     $OPTIMIZE ON

'Schöne Möglichkeit die benötigten BMPs in die EXE einzubinden
     $RESOURCE Lpt_ICON AS "lpt.ico"
     $RESOURCE LED_BMP1 AS "ledgn.bmp"
     $RESOURCE LED_BMP2 AS "ledws.bmp"
     $RESOURCE help_BMP AS "hilfe.bmp"
     $RESOURCE info_BMP AS "info.bmp"
     $RESOURCE raus_BMP AS "ende.bmp"
     $RESOURCE SplashBMP AS "D:\evolution1.bmp"

'aus alter Gewohnheit....
     CONST False = 0
     CONST True = 1

'externe Funktionen aus "inpout32.dll" laden
     DECLARE FUNCTION INP32 LIB "INPOUT32.DLL" ALIAS "Inp32" (Adresse AS INTEGER) AS INTEGER
     DECLARE SUB OUT32 LIB "INPOUT32.DLL" ALIAS "Out32" (Adresse AS INTEGER, Wert AS INTEGER)

'Subs für Form
     DECLARE SUB Led1
     DECLARE SUB Led2
     DECLARE SUB Led3
     DECLARE SUB Led4
     DECLARE SUB Led5
     DECLARE SUB Led6
     DECLARE SUB Led7
     DECLARE SUB Led8
     DECLARE SUB Led9
     DECLARE SUB Led10
     DECLARE SUB Led11
     DECLARE SUB Led12
     DECLARE SUB Led13
     DECLARE SUB Led14
     DECLARE SUB raus
     DECLARE SUB Info
     DECLARE SUB Hilfe
     DECLARE SUB Hex378
     DECLARE SUB Hex278
     DECLARE SUB Hex3bc

     DECLARE SUB TimeOver
     DECLARE SUB SetzData
     DECLARE SUB SetzControl
     DECLARE SUB SetzLED
     DECLARE SUB SplashClose

     DIM port AS INTEGER
     DIM DByte AS INTEGER
     DIM CByte AS INTEGER
     DIM SByte AS INTEGER
     DIM LedHint1 AS STRING
     DIM LedHint2 AS STRING

     DIM aTimer AS QTIMER
     aTimer.Interval = 4500 '4,5s
     aTimer.OnTimer = SplashClose
     aTimer.Enabled = True

'Text für Hint
     LedHint1 ="Click zum wechseln"
     LedHint2 ="nur lesen"

'ein Splash :-))
     CREATE SplashForm AS QFORM
      BorderStyle = False
      Width = 645
      Height = 230
      Center
      CREATE SplashImage AS QIMAGE
       BMPHandle = SplashBMP
       Left = 0
       Top = 0
       Width = 640
       Height = 221
       Align = 5
       Stretch = True
      END CREATE
     END CREATE
     SplashForm.SHOWMODAL

'so nun das Fenster
'ne echte Fleißarbeit
     CREATE Form AS QFORM
      CAPTION = "BitBox für den LPT Port   @ -=I3I2UI\I0=-"
      Width = 440
      Height = 400
      Center
      IcoHandle = Lpt_Icon
      CREATE Image1 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 15
       Top = 109
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led1
      END CREATE
      CREATE Label1 AS QLABEL
       CAPTION = "D0 - PIN 2"
       Left = 40
       Top = 112
       Width = 50
       Transparent = True
      END CREATE
      CREATE Image2 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 15
       Top = 133
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led2
      END CREATE
      CREATE Label2 AS QLABEL
       CAPTION = "D1 - PIN 3"
       Left = 40
       Top = 136
       Width = 50
       Transparent = True
      END CREATE
      CREATE Image3 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 15
       Top = 157
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led3
      END CREATE
      CREATE Label3 AS QLABEL
       CAPTION = "D2 - PIN 4"
       Left = 40
       Top = 160
       Width = 50
       Transparent = True
      END CREATE
      CREATE Image4 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 15
       Top = 181
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led4
      END CREATE
      CREATE Label4 AS QLABEL
       CAPTION = "D3 - PIN 5"
       Left = 40
       Top = 184
       Width = 50
       Transparent = True
      END CREATE
      CREATE Image5 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 15
       Top = 205
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led5
      END CREATE
      CREATE Label5 AS QLABEL
       CAPTION = "D4 - PIN 6"
       Left = 40
       Top = 208
       Width = 50
       Transparent = True
      END CREATE
      CREATE Image6 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 15
       Top = 229
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led6
      END CREATE
      CREATE Label6 AS QLABEL
       CAPTION = "D5 - PIN 7"
       Left = 40
       Top = 232
       Width = 50
       Transparent = True
      END CREATE
      CREATE Image7 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 15
       Top = 253
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led7
      END CREATE
      CREATE Label7 AS QLABEL
       CAPTION = "D6 - PIN 8"
       Left = 40
       Top = 256
       Width = 50
       Transparent = True
      END CREATE
      CREATE Image8 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 15
       Top = 277
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led8
      END CREATE
      CREATE Label8 AS QLABEL
       CAPTION = "D7 - PIN 9"
       Left = 40
       Top = 280
       Width = 50
       Transparent = True
      END CREATE
      CREATE Image9 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 110
       Top = 109
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led9
      END CREATE
      CREATE Label9 AS QLABEL
       CAPTION = "STROBE - PIN 1"
       Left = 135
       Top = 112
       Width = 80
       Transparent = True
      END CREATE
      CREATE Image10 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 110
       Top = 133
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led10
      END CREATE
      CREATE Label10 AS QLABEL
       CAPTION = "AUTO FEED - PIN 14"
       Left = 135
       Top = 136
       Width = 103
       Transparent = True
      END CREATE
      CREATE Image11 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 110
       Top = 157
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led11
      END CREATE
      CREATE Label11 AS QLABEL
       CAPTION = "RESET / INIT - PIN 16"
       Left = 135
       Top = 160
       Width = 110
       Transparent = True
      END CREATE
      CREATE Image12 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 110
       Top = 181
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led12
      END CREATE
      CREATE Label12 AS QLABEL
       CAPTION = "SELECT INPUT - PIN 17"
       Left = 135
       Top = 184
       Width = 119
       Transparent = True
      END CREATE
      CREATE Image13 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 110
       Top = 205
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led13
      END CREATE
      CREATE Label13 AS QLABEL
       CAPTION = "Interrupt enable"
       Left = 135
       Top = 208
       Width = 74
       Transparent = True
      END CREATE
      CREATE Image14 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 110
       Top = 229
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint1
       AutoSize = True
       Center = True
       OnClick = Led14
      END CREATE
      CREATE Label14 AS QLABEL
       CAPTION = "bidirektional (D0 - D7)"
       Left = 135
       Top = 232
       Width = 102
       Transparent = True
      END CREATE
      CREATE Image15 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 110
       Top = 253
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint2
       AutoSize = True
       Center = True
      END CREATE
      CREATE Label15 AS QLABEL
       CAPTION = "undefiniert"
       Left = 135
       Top = 256
       Width = 49
       Transparent = True
      END CREATE
      CREATE Image16 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 110
       Top = 277
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint2
       AutoSize = True
       Center = True
      END CREATE
      CREATE Label16 AS QLABEL
       CAPTION = "undefiniert"
       Left = 135
       Top = 280
       Width = 49
       Transparent = True
      END CREATE
      CREATE Image19 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 270
       Top = 181
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint2
       AutoSize = True
       Center = True
      END CREATE
      CREATE Label19 AS QLABEL
       CAPTION = "ERROR- PIN 15"
       Left = 295
       Top = 184
       Width = 78
       Transparent = True
      END CREATE
      CREATE Image20 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 270
       Top = 205
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint2
       AutoSize = True
       Center = True
      END CREATE
      CREATE Label20 AS QLABEL
       CAPTION = "SELECT - PIN 13"
       Left = 295
       Top = 208
       Width = 83
       Transparent = True
      END CREATE
      CREATE Image21 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 270
       Top = 229
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint2
       AutoSize = True
       Center = True
      END CREATE
      CREATE Label21 AS QLABEL
       CAPTION = "PAPER EMPTY - PIN 12"
       Left = 295
       Top = 232
       Width = 118
       Transparent = True
      END CREATE
      CREATE Image22 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 270
       Top = 253
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint2
       AutoSize = True
       Center = True
      END CREATE
      CREATE Label22 AS QLABEL
       CAPTION = "ACKNOWLEDGE - PIN 10"
       Left = 295
       Top = 256
       Width = 126
       Transparent = True
      END CREATE
      CREATE Image23 AS QIMAGE
       Transparent = True
       BMPHandle = LED_BMP1
       Left = 270
       Top = 277
       Width = 20
       Height = 20
       ShowHint = True
       Hint = LedHint2
       AutoSize = True
       Center = True
      END CREATE
      CREATE Label23 AS QLABEL
       CAPTION = "BUSY - PIN 11"
       Left = 295
       Top = 280
       Width = 71
       Transparent = True
      END CREATE
      CREATE Label25 AS QLABEL
       CAPTION = "DATEN"
       Left = 37
       Top = 78
       Width = 37
       Transparent = True
      END CREATE
      CREATE Label26 AS QLABEL
       CAPTION = "CONTROL"
       Left = 133
       Top = 78
       Width = 52
       Transparent = True
      END CREATE
      CREATE Label27 AS QLABEL
       CAPTION = "STATUS"
       Left = 293
       Top = 78
       Width = 43
       Transparent = True
      END CREATE
      CREATE Label28 AS QLABEL
       CAPTION = "Printer - Port Adresse"
       Left = 35
       Top = 24
       Width = 99
       Transparent = True
       OnClick = Hex378
      END CREATE
      CREATE Label17 AS QLABEL
       CAPTION = "Masse an PIN 18-25"
       Left = 171
       Top = 304
       Width = 97
       Transparent = True
      END CREATE
      CREATE Button1 AS QBUTTON
       CAPTION = "Info"
       BMPHandle = info_BMP
       Left = 20
       Top = 322
       Width = 127
       Height = 45
       OnClick = Info
      END CREATE
      CREATE Button2 AS QBUTTON
       CAPTION = "Hilfe"
       BMPHandle = help_BMP
       Left = 150
       Top = 322
       Width = 127
       Height = 45
       TabOrder = 1
       OnClick = hilfe
      END CREATE
      CREATE Button3 AS QBUTTON
       CAPTION = "Ende"
       BMPHandle = raus_BMP
       Left = 280
       Top = 322
       Width = 127
       Height = 45
       TabOrder = 2
       OnClick = raus
      END CREATE
      CREATE RadioButton1 AS QRADIOBUTTON
       CAPTION = "Hex378"
       Left = 36
       Top = 47
       Width = 57
       TabOrder = 3
       OnClick = Hex378
      END CREATE
      CREATE RadioButton2 AS QRADIOBUTTON
       CAPTION = "Hex278"
       Left = 124
       Top = 47
       Width = 57
       TabOrder = 4
       OnClick = Hex278
      END CREATE
      CREATE RadioButton3 AS QRADIOBUTTON
       CAPTION = "Hex3BC"
       Left = 220
       Top = 47
       Width = 65
       TabOrder = 5
       OnClick = Hex3bc
      END CREATE
     END CREATE

     Hex378
     SByte = INP32(port+1)

     Form.SHOWMODAL

'--------- Subroutinen ---------

     SUB SplashClose
      SplashForm.CLOSE 'Splash end
      aTimer.Interval = 400'mS
      aTimer.OnTimer = TimeOver
     END SUB

     SUB TimeOver
      aTimer.Interval = 400
      IF SByte <> INP32(port+1) THEN  SetzLED
      SByte = INP32(port+1)
     END SUB

     SUB Led1: Dbyte =1: SetzData:END SUB
     SUB Led2: Dbyte =2: SetzData:END SUB
     SUB Led3: Dbyte =4: SetzData:END SUB
     SUB Led4: Dbyte =8: SetzData:END SUB
     SUB Led5: Dbyte =16: SetzData:END SUB
     SUB Led6: Dbyte =32: SetzData:END SUB
     SUB Led7: Dbyte =64: SetzData:END SUB
     SUB Led8: Dbyte =128: SetzData:END SUB
     SUB Led9: Cbyte =1: SetzControl:END SUB
     SUB Led10: Cbyte =2: SetzControl:END SUB
     SUB Led11: Cbyte =4: SetzControl:END SUB
     SUB Led12: Cbyte =8: SetzControl:END SUB
     SUB Led13: Cbyte =16: SetzControl:END SUB
     SUB Led14: Cbyte =32: SetzControl:END SUB
     SUB Hex378: port=&H378: RadioButton1.Checked= True: SetzLED:END SUB
     SUB Hex278: port=&H278: SetzLED: END SUB
     SUB Hex3bc: port=&H3bc: SetzLED: END SUB

     SUB Info
      MBTxt$=           "Freeware von -=I3I2UI\I0=- " + CHR$(10)
      MBTxt$ = MBTxt$ + "Quelltext inklusive" + CHR$(10)
      MBTxt$ = MBTxt$ + "Programmiert mit Rapid-Q -Freeware- www.basicguru.com/rapidq" + CHR$(10)
      MBTxt$ = MBTxt$ + "Portzugriffe mit inpout32.dll -Freeware- www.logix4u.net" + CHR$(10)
      MBTxt$ = MBTxt$ + "für Win 9X/ME/NT/2000/XP"
      RetVal = MESSAGEBOX (MBTxt$,"Info -=I3I2UI\I0=-",64)
     END SUB

     SUB Hilfe: SHELL "notepad BitBox.bas": END SUB

     SUB SetzControl
      ist% = INP32(port+2)
      OUT32 port+2, ist% XOR Cbyte
      SetzLED
     END SUB

     SUB SetzData
      ist% = INP32(port)
      OUT32 port, ist% XOR Dbyte
      SetzLED
     END SUB

     SUB SetzLED
  'Registerinhalte einlesen und mit den LEDs anzeigen
      ist% = INP32(port)
      IF ist% AND 1 THEN: Image1.BMPHandle = LED_BMP1: ELSE: Image1.BMPHandle = LED_BMP2: END IF
      IF ist% AND 2 THEN: Image2.BMPHandle = LED_BMP1: ELSE: Image2.BMPHandle = LED_BMP2: END IF
      IF ist% AND 4 THEN: Image3.BMPHandle = LED_BMP1: ELSE: Image3.BMPHandle = LED_BMP2: END IF
      IF ist% AND 8 THEN: Image4.BMPHandle = LED_BMP1: ELSE: Image4.BMPHandle = LED_BMP2: END IF
      IF ist% AND 16 THEN: Image5.BMPHandle = LED_BMP1: ELSE: Image5.BMPHandle = LED_BMP2: END IF
      IF ist% AND 32 THEN: Image6.BMPHandle = LED_BMP1: ELSE: Image6.BMPHandle = LED_BMP2: END IF
      IF ist% AND 64 THEN: Image7.BMPHandle = LED_BMP1: ELSE: Image7.BMPHandle = LED_BMP2: END IF
      IF ist% AND 128 THEN: Image8.BMPHandle = LED_BMP1: ELSE: Image8.BMPHandle = LED_BMP2: END IF

      ist% = INP32(port+2)
      IF ist% AND 1 THEN: Image9.BMPHandle = LED_BMP1: ELSE: Image9.BMPHandle = LED_BMP2: END IF
      IF ist% AND 2 THEN: Image10.BMPHandle = LED_BMP1: ELSE: Image10.BMPHandle = LED_BMP2: END IF
      IF ist% AND 4 THEN: Image11.BMPHandle = LED_BMP1: ELSE: Image11.BMPHandle = LED_BMP2: END IF
      IF ist% AND 8 THEN: Image12.BMPHandle = LED_BMP1: ELSE: Image12.BMPHandle = LED_BMP2: END IF
      IF ist% AND 16 THEN: Image13.BMPHandle = LED_BMP1: ELSE: Image13.BMPHandle = LED_BMP2: END IF
      IF ist% AND 32 THEN: Image14.BMPHandle = LED_BMP1: ELSE: Image14.BMPHandle = LED_BMP2: END IF
      IF ist% AND 64 THEN: Image15.BMPHandle = LED_BMP1: ELSE: Image15.BMPHandle = LED_BMP2: END IF
      IF ist% AND 128 THEN: Image16.BMPHandle = LED_BMP1: ELSE: Image16.BMPHandle = LED_BMP2: END IF

      ist% = INP32(port+1)
      IF ist% AND 8 THEN: Image19.BMPHandle = LED_BMP1: ELSE: Image19.BMPHandle = LED_BMP2: END IF
      IF ist% AND 16 THEN: Image20.BMPHandle = LED_BMP1: ELSE: Image20.BMPHandle = LED_BMP2: END IF
      IF ist% AND 32 THEN: Image21.BMPHandle = LED_BMP1: ELSE: Image21.BMPHandle = LED_BMP2: END IF
      IF ist% AND 64 THEN: Image22.BMPHandle = LED_BMP1: ELSE: Image22.BMPHandle = LED_BMP2: END IF
      IF ist% AND 128 THEN: Image23.BMPHandle = LED_BMP1: ELSE: Image23.BMPHandle = LED_BMP2: END IF
     END SUB

     SUB raus:Form.CLOSE:END SUB
'* Ende des Qelltextes *
掌柜推荐
 
 
¥1,290.00 ·
 
 
¥918.00 ·
 
 
¥890.00 ·
 
 
¥294.00 ·
 
 
¥430.00 ·
 
 
¥1,380.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2004-06-30 20:58:18