tailieunhanh - Parallel Port Complete- P9
Parallel Port Complete- P9: From its origin as a simple printer interface, the personal computer's parallel port has evolved into a place to plug in just about anything you might want to hook to a computer. The parallel port is popular because it's versatile-you can use it for output, input, or bidirectional links-and because it's available-every PC has one. | Chapter 7 Const OPENSWITCH 0 Const CLOSESWITCH 1 Sub ActivateSwitch OpenOrClose Dim Strobe Dim XY Data port bit 7 OpenOrClose 0 open l close OpenOrClose OpenOrClose H80 Data port bit 6 Strobe. Strobe H40 Data port bits 0-2 hold the X value bits 3-5 hold the Y value. XY - 1 - 1 8 Write the address select open or close Strobe 1 DataPortWrite BaseAddress XY Strobe OpenOrClose Pulse the Strobe input. DataPortWrite BaseAddress XY OpenOrClose DataPortWrite BaseAddress XY Strobe OpenOrClose End Sub Sub DisplayResults Select Case Switchstate Case Closed X Case Open End Select End Sub Sub Form_Load Startup LabelTheGrid End Sub Sub grdXY_Click Select Case Case X ActivateSwitch OPENSWITCH Switchstate Open DisplayResults Case Else ActivateSwitch CLOSESWITCH Switchstate - Closed DisplayResults End Select End Sub Listing 7-2 Controlling an 8 x 8 crosspoint switch Sheet 1 of 2 146 Parallel Port Complete Please purchase PDF Split-Merge on to remove this watermark. Output Applications Sub LabelTheGrid Dim Row Dim Column 0 For Row 1 To 8 grdXY . Row Row Y Row - 1 Next Row 0 For Column 1 To 8 Column X Column - 1 Next Column 8x8 Crosspoint Switch End Sub Listing 7-2 Controlling an 8 x 8 crosspoint switch Sheet 2 of 2 display the switch matrix. When you click on a cell the associated switch opens or closes. An X indicates a closed switch an empty cell indicates an open switch. You can make and break as many connections as you want by writing appropriate values to the chip. All previous switch settings remain until you change them by writing to the specific switch. The switches can connect in any combination. For example you can connect each X pin to a different Y pin to create eight distinct signal paths. Or you can connect all eight Y pins to a single X pin to route one signal to eight different paths. The X and Y pins may connect to external inputs or
đang nạp các trang xem trước