[ programer15 @ 04.07.2011. 15:11 ] @
E vak znam da LPT ima 5 ulaznih msm(status port) e sad da bi registrovao signal na status portu podrebno je dovesti masu(GND) na neki pin od status porta ali mene zanima kako bih i na koji pin dovesti +5V i da ocitam na programu znaci program nije problem vec me znanima kako bih mogao to uraditi sto sam gore naveo!!!
[ shpiki @ 04.07.2011. 16:59 ] @
Ako ces da ocitavas samo stanje pina svejedno je da li je 5V ili 0, osim ako neces nesto drugo sa tih 5V?
[ programer15 @ 04.07.2011. 18:57 ] @
Uspio sam postici to jednostavno sa D0 sam uzimao +5V i na bilo koji pin status porta spojio i ocitao u svakom slucaju hvala!!!
[ arakis @ 05.07.2011. 08:19 ] @
kolko se ja secam, kompjuter cita "1" kad pin "visi" a 0 kad je povezan na "masu", drugim recima, ako pravis neki prekidac koji treba da ti se ocita u programu, opusteno mozes da stavis prekid za "1", spoj na masu za "0", netreba ti 5V sa D0 uopste.
[ programer15 @ 05.07.2011. 08:51 ] @
Evo kako sam to uradio!!!

evo koda
Code:
Private Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)
Private Declare Sub PortWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Integer)
Private Declare Sub PortDWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Long)
Private Declare Function PortIn Lib "IO.DLL" (ByVal Port As Integer) As Byte
Private Declare Function PortWordIn Lib "IO.DLL" (ByVal Port As Integer) As Integer
Private Declare Function PortDWordIn Lib "IO.DLL" (ByVal Port As Integer) As Long
Private Declare Sub SetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Private Declare Sub ClrPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Private Declare Sub NotPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Private Declare Function GetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte) As Boolean
Private Declare Function RightPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Private Declare Function LeftPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Private Declare Function IsDriverInstalled Lib "IO.DLL" () As Boolean
Public Broj, LPTadresa, SPTAdresa As Integer

Private Sub Form_Load()
    LPTadresa = &H378
    SPTAdresa = LPTadresa + 1
End Sub
Private Sub Option1_Click()
If Option1 Then LPTadresa = &H378
    SPTAdresa = LPTadresa + 1
End Sub
Private Sub Option2_Click()
    If Option2 Then LPTadresa = &H278
    SPTAdresa = LPTadresa + 1
End Sub
Private Sub Option3_Click()
    If Option3 Then LPTadresa = &H3BC
    SPTAdresa = LPTadresa + 1
End Sub

Private Sub Timer1_Timer()
Dim j As Integer
Dim Broj As Byte
Dim i As Byte
  
  Broj = PortIn(SPTAdresa)
  Broj = Broj Xor 128
    
  
    If GetPortBit(SPTAdresa, 5) Then
      Shape2.BackColor = RGB(0, 0, 255)
      Else
      Shape2.BackColor = RGB(255, 255, 255)
     End If
  End Sub]