|
-
Dec 20th, 2005, 10:50 AM
#1
Thread Starter
Junior Member
[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:
Private Declare Sub SetPortBit Lib "IO" (ByVal Port As Integer, ByVal Bit As Integer)
Private Declare Sub ClrPortBit Lib "IO" (ByVal Port As Integer, ByVal Bit As Integer)
Private Declare Sub NotPortBit Lib "IO.dll" (ByVal Port As Integer, ByVal Bit As Integer)
Private Declare Function GetPortBit Lib "IO.dll" (ByVal Port As Integer, ByVal Bit As Integer) As Integer
Private Declare Sub RightPortShift Lib "IO.dll" (ByVal Port As Integer, ByVal ShiftIn As Integer)
Private Declare Sub LeftPortShift Lib "IO.dll" (ByVal Port As Integer, ByVal ShiftIn As Integer)
'Private Declare Sub PortOut Lib "IO.dll" (ByVal Port As Integer, ByVal Data As Byte)
'Private Declare Sub PortIn Lib "IO.dll" (ByVal Port As Integer, ByVal Data As Byte)
Private Sub Command1_Click()
PortOut 888, 1 'relay 1 on
End Sub
Private Sub Command2_Click()
PortOut 888, -1 ' relay 1 off
End Sub
Private Sub Command3_Click()
PortOut 888, 2 'relay 2 on
End Sub
Private Sub Command4_Click()
PortOut 888, -2 'relay 2 off
End Sub
Private Sub Command5_Click()
PortOut 888, 0 'relays all off
End Sub
ive got then xp io.dll
if you could help cheers
-
Dec 20th, 2005, 11:19 AM
#2
Thread Starter
Junior Member
Re: ReadPort then Portout -1 ?
Ive solved it (god i need sleep)
clrbit i was trying to clear byte
-
Dec 20th, 2005, 11:28 AM
#3
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|