Hallo,
Ik heb een eenvoudige LPT-interfacekaart gemaakt.
In dos kan ik deze besturen met het programma qbasic.
Nu zou ik deze ook graag in windows XP gebruiken, maar ik heb alleen visual basic for applications in excell.
Kan dit hiermee geprogrammeerd worden?
Als ik in de categorie "artikelen" op "hier" klik, download ik alleen een exe-bestand en ik vind nergens het io.dll-bestand.
Kan iemand mij helpen?
misschien is het een exe file die als soort zelfuitpakkend archief werkt en zodanig de dll ergens plaats?
De volgende dll moet je hebben.
io.dll (dit is niet de enige maar deze vind ik fijn werken)
De dll zet je dan in je system32 map.
Dan maak je in je visual basic een module aan en daarin plaats je de volgende code:
Declare Sub SetPortBit Lib "io.dll" (ByVal Port As Integer, ByVal Value As Byte)
Declare Function PortIn Lib "io.dll" (ByVal Port As Integer) As Byte
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) ' resolutie 10 a 20 millisec
' data status control
Global Const BIT0 = &H1 ' D0 0 /STROBE
Global Const BIT1 = &H2 ' D1 0 /AUTOFEED
Global Const BIT2 = &H4 ' D2 0 /INIT
Global Const BIT3 = &H8 ' D3 ERROR /SLCTIN
Global Const BIT4 = &H10 ' D4 SELECT 0
Global Const BIT5 = &H20 ' D5 PAPER EMPTY 0
Global Const BIT6 = &H40 ' D6 ACK 0
Global Const BIT7 = &H80 ' D7 /BUSY 0
Global LptData As Byte
Global LptStatus As Byte
Global LptControl As Byte
Sub LPT_DataReg_PinHigh(ByVal MyBit As Long)
' The Data Register (8 output bits, bit 0 to 7)
' set the pin to '1' (high)
Call SetPortBit(&H387, MyBit)
End Sub
Sub LPT_DataReg_PinLow(ByVal MyBit As Long)
' Zie tekst bij LPT_DataReg_PinHigh
' set the pin to '0' (low)
Call ClrPortBit(&H387, MyBit)
End SubVerder kun je gewoon de instructies van het artikel volgen.
Leime
Bedankt voor alle reacties, maar ik had ondertussen deze site gevonden:
http://www.geekhideout.com/iodll.shtml
Nu werkt het ook.
Ik heb nu hetvolgende programma gemaakt om het op een bepaald tijdstip doen aan en uit te gaan:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)
Private Sub CommandButton1_Click()
Dim Aanstr As String
Dim Uitstr As String
Dim Aan As Date
Dim Uit As Date
Aanstr = TextBox1
Uitstr = TextBox2
Aan = CDate(Aanstr)
Uit = CDate(Uitstr)
LabelAan: Sleep 3000
If Time() > Aan And Time() < Aan + #00:00:08 AM# Then
PortOut 888, 1
Else: GoTo LabelAan
End If
LabelUit: Sleep 3000
If Time() > Uit And Time() < Uit + #00:00:08 AM# Then
PortOut 888, 0
Else: GoTo LabelUit
End If
End SubHet heeft wel een nadeel: je hebt een oneindige lus en als je wat teveel klikt, beschouwt de computer het als een niet-reagerend programma.
Heeft iemand een beter idee om dit te maken?
timmie
niet met me uitspraken(of opmerkingen) eens mail me.K8048 guide
moet je toevallig niet omswitchen tussen input en output
of dit gebruiken:
Declare Function PortIn Lib "io.dll" (ByVal Port As Integer) As Byte
[Bericht gewijzigd door timmie op (49%)]