VERSION 5.00 Begin VB.Form Form1 Caption = "Form1" ClientHeight = 3195 ClientLeft = 60 ClientTop = 345 ClientWidth = 4680 LinkTopic = "Form1" ScaleHeight = 3195 ScaleWidth = 4680 StartUpPosition = 3 'Windows Default Begin VB.CommandButton cmdCounter Caption = "Counter" Height = 315 Left = 1200 TabIndex = 3 Top = 780 Width = 975 End Begin VB.CommandButton cmdClockwise Caption = "Clockwise" Height = 315 Left = 180 TabIndex = 2 Top = 780 Width = 975 End Begin VB.CommandButton cmdStart Appearance = 0 'Flat Caption = "Start" Height = 375 Left = 1140 TabIndex = 1 Top = 180 Width = 675 End Begin VB.Timer tmrMain Enabled = 0 'False Interval = 10 Left = 1920 Top = 120 End Begin VB.CommandButton cmdToggle Caption = "Toggle" Height = 375 Left = 240 TabIndex = 0 Top = 180 Width = 795 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Declare Function Inp Lib "inpout32.dll" _ Alias "Inp32" (ByVal PortAddress As Integer) As Integer Private Declare Sub Out Lib "inpout32.dll" _ Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer) Dim current As Byte Const base_port = &H378 Private Sub cmdStart_Click() If cmdStart.Caption = "Start" Then tmrMain.Enabled = True cmdStart.Caption = "Stop" Else tmrMain.Enabled = False cmdStart.Caption = "Start" End If End Sub Private Sub tmrMain_Timer() cmdToggle_Click End Sub Private Sub cmdToggle_Click() If cmdToggle.Caption = "Make 1" Then current = current Or &H1& ' 0000 0001 Out base_port, current cmdToggle.Caption = "Make 0" Else current = current And &HFE& ' 1111 1110 Out base_port, current cmdToggle.Caption = "Make 1" End If End Sub Private Sub Form_Load() ' 13 12 11 10 ... 2 1 (wider) ' 25 24 ... 15 14 'Pin Name Dir Reg ' 1 nStrobe Out C0 (Inverted) ' 2 Data0 In/Out D0 ' 3 Data1 In/Out D1 ' 4 Data2 In/Out D2 ' 5 Data3 In/Out D3 ' 6 Data4 In/Out D4 ' 7 Data5 In/Out D5 ' 8 Data6 In/Out D6 ' 9 Data7 In/Out D7 ' 10 nAck In S6 ' 11 Busy In S7 (Inverted) ' 12 PaperOut In S5 ' 13 Select In S4 ' 14 Linefeed Out C1 (Inverted) ' 15 nError In S3 ' 16 nInit Out C2 ' 17 nSelect Out C3 (Inverted) ' 18-25 Ground ' lpt1 base = 0x378; lpt2=0x278 ' data = +0 ' status = +1 ' control = +2 End Sub Private Sub cmdClockwise_Click() current = current Or &H2& ' 0000 0010 Out base_port, current End Sub Private Sub cmdCounter_Click() current = current And &HFD& ' 1111 1101 Out base_port, current End Sub