Source code how make a DLL for manage LPT1 Parallel port and work with 4 inputs and 4 output , You can decode dtmf with a 8870 chip or manage
API Declarations
Public Declare Function DlPortReadPortUchar Lib "dlportio.dll" (ByVal Port As Long) As Byte
Public Declare Function DlPortReadPortUshort Lib "dlportio.dll" (ByVal Port As Long) As Integer
Public Declare Function DlPortReadPortUlong Lib "dlportio.dll" (ByVal Port As Long) As Long
Public Declare Sub DlPortReadPortBufferUchar Lib "dlportio.dll" (ByVal Port As Long, Buffer As Any, ByVal Count As Long)
Public Declare Sub DlPortReadPortBufferUshort Lib "dlportio.dll" (ByVal Port As Long, Buffer As Any, ByVal Count As Long)
Public Declare Sub DlPortReadPortBufferUlong Lib "dlportio.dll" (ByVal Port As Long, Buffer As Any, ByVal Count As Long)
Public Declare Sub DlPortWritePortUchar Lib "dlportio.dll" (ByVal Port As Long, ByVal Value As Byte)
Public Declare Sub DlPortWritePortUshort Lib "dlportio.dll" (ByVal Port As Long, ByVal Value As Integer)
Public Declare Sub DlPortWritePortUlong Lib "dlportio.dll" (ByVal Port As Long, ByVal Value As Long)
Public Declare Sub DlPortWritePortBufferUchar Lib "dlportio.dll" (ByVal Port As Long, Buffer As Any, ByVal Count As Long)
Public Declare Sub DlPortWritePortBufferUshort Lib "dlportio.dll" (ByVal Port As Long, Buffer As Any, ByVal Count As Long)
Public Declare Sub DlPortWritePortBufferUlong Lib "dlportio.dll" (ByVal Port As Long, Buffer As Any, ByVal Count As Long)
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Function BinToDec%(BinNumber$)
Dim Weight%
Dim Dec%
Dim i%
Weight% = 1
Dec% = 0 'Reset decimal number
If BinNumber$ <> "00000000" Then
For i% = Len(BinNumber$) To 1 Step -1
If Mid$(BinNumber$, i%, 1) = "1" Then
Dec% = Dec% + Weight% 'If bit=1 then add weigth factor
End If
Weight% = Weight% * 2 'Multiply weight factor by 2
Next
BinToDec% = Dec% 'Store result
Else
BinToDec% = 0
End If
End Function
Function DecToBin$(Decnumber%)
'Conversion of decimal number (0...255) to 8 bit binary string.
'--------------------------------------------------------------
Dim Bin$
Dim Faktor%, i%
Bin$ = ""
Faktor% = 128
If Decnumber% <> 0 Then
For i% = 1 To 8
If Faktor% > Decnumber% Then
Bin$ = Bin$ + "0"
Else
Bin$ = Bin$ + "1"
Decnumber% = Decnumber% - Faktor%
End If
Faktor% = Faktor% \ 2
Next
DecToBin$ = Bin$
Else
DecToBin$ = "00000000"
End If
End Function