Results 1 to 3 of 3

Thread: [RESOLVED] ReadPort then Portout -1 ?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Location
    UK
    Posts
    21

    Resolved [RESOLVED] ReadPort then Portout -1 ?

    Hi all
    Ive been playing around with parallel port relays (you guessed it heard it before)

    any way the problem ive got i can get relays on and off But i want say relay 1 off but not to change any of the conditions of any other (i thought of writing port byte to text file then read file and then write to port - 1 eg but dont work)

    anyway this is what ive got - just sets all relay on

    VB Code:
    1. Private Declare Sub SetPortBit Lib "IO" (ByVal Port As Integer, ByVal Bit As Integer)
    2. Private Declare Sub ClrPortBit Lib "IO" (ByVal Port As Integer, ByVal Bit As Integer)
    3. Private Declare Sub NotPortBit Lib "IO.dll" (ByVal Port As Integer, ByVal Bit As Integer)
    4. Private Declare Function GetPortBit Lib "IO.dll" (ByVal Port As Integer, ByVal Bit As Integer) As Integer
    5. Private Declare Sub RightPortShift Lib "IO.dll" (ByVal Port As Integer, ByVal ShiftIn As Integer)
    6. Private Declare Sub LeftPortShift Lib "IO.dll" (ByVal Port As Integer, ByVal ShiftIn As Integer)
    7.  
    8. 'Private Declare Sub PortOut Lib "IO.dll" (ByVal Port As Integer, ByVal Data As Byte)
    9. 'Private Declare Sub PortIn Lib "IO.dll" (ByVal Port As Integer, ByVal Data As Byte)
    10.  
    11. Private Sub Command1_Click()
    12. PortOut 888, 1                 'relay 1 on
    13. End Sub
    14.  
    15. Private Sub Command2_Click()
    16.  
    17. PortOut 888, -1               ' relay 1 off  
    18. End Sub
    19.  
    20. Private Sub Command3_Click()
    21. PortOut 888, 2                   'relay 2 on
    22. End Sub
    23.  
    24. Private Sub Command4_Click()
    25. PortOut 888, -2                  'relay 2 off
    26. End Sub
    27.  
    28. Private Sub Command5_Click()
    29. PortOut 888, 0                 'relays all off
    30. End Sub

    ive got then xp io.dll
    if you could help cheers

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Location
    UK
    Posts
    21

    Re: ReadPort then Portout -1 ?

    Ive solved it (god i need sleep)

    clrbit i was trying to clear byte


  3. #3
    Hyperactive Member
    Join Date
    Feb 2003
    Location
    Grenada
    Posts
    346

    Re: ReadPort then Portout -1 ?

    I'm getting a nasty exception error when I try to access any function from the DLL...

    The best port accessing module I would say would have to be the InpOut32.dll...

    Look for it in Google... That's what I used in all my projects.

    It automatically installs and configures itself to your OS plus it comes with examples for the majority of programming lanuages...

    Give it a try... if you're using that then I can help you out better...
    If my post has been helpful, then please rate it accordingly...
    If it has solved your question(s), then don't forget to mark the thread as "[Resolved]"... thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width