forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Parallel port output

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
nickos
Valued Newbie


Joined: 17 Mar 2007
Posts: 26

PostPosted: Thu Aug 30, 2007 1:38 pm    Post subject: Parallel port output Reply with quote

Is there an easy way in VDS to control pin output on Parallel port? Embarassed
(D0,...,D8,D9)
Back to top
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Thu Aug 30, 2007 2:22 pm    Post subject: Reply with quote

Nickos,
I am currently working on this. I already have working code for it which I will be releasing soon. Hopefully within the next week.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Sun Sep 02, 2007 1:36 am    Post subject: Reply with quote

Take a look at this thread http://forum.vdsworld.com/viewtopic.php?t=3229
The IO.DLL that I reference is a tiny (47k) dll that works great with VDS.

I have a sample script to control a parallel port using that dll if you're interested.
.........David
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Mon Sep 03, 2007 10:49 am    Post subject: Reply with quote

Hi david, I'm interested in seeing a sample script that uses IO.dll
_________________
cheers

Dave
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Sep 03, 2007 3:53 pm    Post subject: Reply with quote

DavidR,
I would like to see that sample too because I have tried to use the @lib() function to call the real inp and outp functions and that was not very reliable since the @lib() function does not allow you to define a parameter as a WORD or BYTE variable type and was causing the stack to become corrupt.
Anyway I do have a much more reliable solution that will be released with the new build of my GadgetX.dll... The new build should be released this week.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Tue Sep 04, 2007 9:29 am    Post subject: Sample Parallel port code Reply with quote

This is a really simple script that allows you to toggle the parallel port IO lines using the IO.DLL.
You need to make sure your parallel port base address is correct, then you can check/uncheck the boxes to toggle each line.

I've also used this dll to control a 48 IO board that plugs into an ISA slot. I can post that example as well but I have to get it from another PC.
....David

Code:
  DIALOG CREATE,Parallel Port Tool,-1,0,174,260
  DIALOG ADD,BUTTON,REFRESH,64,80,50,16,Refresh
  DIALOG ADD,CHECK,CHECK1,64,8,72,16,Bit 1,,,CLICK
  DIALOG ADD,CHECK,CHECK2,88,8,72,16,Bit 2,,,CLICK
  DIALOG ADD,CHECK,CHECK3,112,8,72,16,Bit 3,,,CLICK
  DIALOG ADD,CHECK,CHECK4,136,8,72,16,Bit 4,,,CLICK
  DIALOG ADD,CHECK,CHECK5,160,8,72,16,Bit 5,,,CLICK
  DIALOG ADD,CHECK,CHECK6,184,8,72,16,Bit 6,,,CLICK
  DIALOG ADD,CHECK,CHECK7,208,8,72,16,Bit 7,,,CLICK
  DIALOG ADD,CHECK,CHECK8,232,8,72,16,Bit 8,,,CLICK
  DIALOG ADD,EDIT,EDIT1,32,40,40,16,378
  DIALOG ADD,TEXT,TEXT1,16,16,,,Base Address (HEX)
  DIALOG SHOW


LOADLIB io.dll
goto BEGIN
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:REFRESHBUTTON
:BEGIN
%%PORT = @dlgtext(EDIT1)
rem easy way to convert from hex to decimal
%%PORT = @sum($%%PORT,0)

IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,0)
DIALOG SET,CHECK1,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK1
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,1)
DIALOG SET,CHECK2,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK2
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,2)
DIALOG SET,CHECK3,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK3
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,3)
DIALOG SET,CHECK4,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK4
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,4)
DIALOG SET,CHECK5,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK5
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,5)
DIALOG SET,CHECK6,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK6
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,6)
DIALOG SET,CHECK7,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK7
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,7)
DIALOG SET,CHECK8,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK8
%A = @EVENT()
end
goto EVLOOP


:CHECK1CLICK
IF @dlgtext(CHECK1)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,0)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,0)
END
goto BEGIN
:CHECK2CLICK
IF @dlgtext(CHECK2)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,1)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,1)
END
goto BEGIN
:CHECK3CLICK
IF @dlgtext(CHECK3)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,2)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,2)
END
goto BEGIN
:CHECK4CLICK
IF @dlgtext(CHECK4)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,3)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,3)
END
goto BEGIN
:CHECK5CLICK
IF @dlgtext(CHECK5)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,4)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,4)
END
goto BEGIN
:CHECK6CLICK
IF @dlgtext(CHECK6)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,5)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,5)
END
goto BEGIN
:CHECK7CLICK
IF @dlgtext(CHECK7)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,6)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,6)
END
goto BEGIN
:CHECK8CLICK
IF @dlgtext(CHECK8)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,7)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,7)
END
goto BEGIN


:CLOSE

FREELIB io.dll
EXIT
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Sep 04, 2007 11:32 am    Post subject: Reply with quote

Thanks DavidR
_________________
cheers

Dave
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Sep 04, 2007 12:37 pm    Post subject: Reply with quote

DavidR,
So you have not had any trouble with stack corruption or unexplained errors? When I tried something similar I noticed that from time to time the @lib() function would not send just a single byte or Word it was actually pushing 4 bytes onto the stack and sometimes the functions were not cleaning up the stack properly which left old data on the stack that kept causing errors or in appropriately accessing other IO ports. Maybe the IO.dll is casting the arguments to the proper types before calling the real functions inp and outp? Curious Confused

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Tue Sep 04, 2007 12:41 pm    Post subject: Reply with quote

Dragonsphere,
No I've not had any problems at all to this point.
I've used the dll pretty extensively with my IO board and it's worked like a charm.
Hardly a definitive test of course but my personal experience so far has been good.
...........David
Back to top
View user's profile Send private message
nickos
Valued Newbie


Joined: 17 Mar 2007
Posts: 26

PostPosted: Sun Sep 09, 2007 2:50 pm    Post subject: Reply with quote

Very Happy Thanks David, the scripts is works.
I used it to control my fireworks from onboard lpt.

Any idea to control more than 8 point ?
Back to top
View user's profile Send private message Send e-mail
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Wed Sep 19, 2007 1:32 am    Post subject: Reply with quote

nickos wrote:
Very Happy Thanks David, the scripts is works.
I used it to control my fireworks from onboard lpt.

Any idea to control more than 8 point ?


Well here's a script I threw together to access 16 ports.
Sorry it's not very refined but I was testing an io board and needed something quick. You will need to change the ports of course but hopefully it will be helpful.
Sorry for the slow response, I've been out of town at training.
.................David
Code:
  DIALOG CREATE,Parallel Port Tool,-1,0,174,460
  DIALOG ADD,BUTTON,REFRESH,64,80,50,16,Refresh
  DIALOG ADD,CHECK,CHECK1,64,8,72,16,Bit 1,,,CLICK
  DIALOG ADD,CHECK,CHECK2,88,8,72,16,Bit 2,,,CLICK
  DIALOG ADD,CHECK,CHECK3,112,8,72,16,Bit 3,,,CLICK
  DIALOG ADD,CHECK,CHECK4,136,8,72,16,Bit 4,,,CLICK
  DIALOG ADD,CHECK,CHECK5,160,8,72,16,Bit 5,,,CLICK
  DIALOG ADD,CHECK,CHECK6,184,8,72,16,Bit 6,,,CLICK
  DIALOG ADD,CHECK,CHECK7,208,8,72,16,Bit 7,,,CLICK
  DIALOG ADD,CHECK,CHECK8,232,8,72,16,Bit 8,,,CLICK
  DIALOG ADD,CHECK,CHECK9,256,8,72,16,Bit 1,,,CLICK
  DIALOG ADD,CHECK,CHECK10,280,8,72,16,Bit 2,,,CLICK
  DIALOG ADD,CHECK,CHECK11,304,8,72,16,Bit 3,,,CLICK
  DIALOG ADD,CHECK,CHECK12,328,8,72,16,Bit 4,,,CLICK
  DIALOG ADD,CHECK,CHECK13,352,8,72,16,Bit 5,,,CLICK
  DIALOG ADD,CHECK,CHECK14,376,8,72,16,Bit 6,,,CLICK
  DIALOG ADD,CHECK,CHECK15,400,8,72,16,Bit 7,,,CLICK
  DIALOG ADD,CHECK,CHECK16,424,8,72,16,Bit 8,,,CLICK
  DIALOG ADD,EDIT,EDIT1,32,40,40,16,1B0
  DIALOG ADD,TEXT,TEXT1,16,16,,,Base Address (HEX)
  DIALOG SHOW


LOADLIB io.dll

%A = @LIB(io.dll,PortOut,BYTE:,435,128)
%A = @LIB(io.dll,PortOut,BYTE:,439,128)
goto BEGIN
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:TIMER
:REFRESHBUTTON
:BEGIN

%%PORT = @dlgtext(EDIT1)
rem easy way to convert from hex to decimal
%%PORT = @sum($%%PORT,0)
%%PORTB = @SUM(%%PORT,4)
%%CNTRLA = @SUM(%%PORT,3)
%%CNTRLB = @SUM(%%PORTB,3)

IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,0)
DIALOG SET,CHECK1,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK1
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,1)
DIALOG SET,CHECK2,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK2
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,2)
DIALOG SET,CHECK3,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK3
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,3)
DIALOG SET,CHECK4,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK4
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,4)
DIALOG SET,CHECK5,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK5
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,5)
DIALOG SET,CHECK6,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK6
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,6)
DIALOG SET,CHECK7,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK7
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORT,7)
DIALOG SET,CHECK8,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK8
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORTB,0)
DIALOG SET,CHECK9,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK9
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORTB,1)
DIALOG SET,CHECK10,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK10
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORTB,2)
DIALOG SET,CHECK11,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK11
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORTB,3)
DIALOG SET,CHECK12,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK12
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORTB,4)
DIALOG SET,CHECK13,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK13
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORTB,5)
DIALOG SET,CHECK14,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK14
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORTB,6)
DIALOG SET,CHECK15,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK15
%A = @EVENT()
end
IF @LIB(io.dll,GetPortBit,BOOL:,%%PORTB,7)
DIALOG SET,CHECK16,1
%A = @EVENT()
ELSE
DIALOG SET,CHECK16
%A = @EVENT()
end
goto EVLOOP


:CHECK1CLICK
IF @dlgtext(CHECK1)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,0)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,0)
END
goto BEGIN
:CHECK2CLICK
IF @dlgtext(CHECK2)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,1)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,1)
END
goto BEGIN
:CHECK3CLICK
IF @dlgtext(CHECK3)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,2)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,2)
END
goto BEGIN
:CHECK4CLICK
IF @dlgtext(CHECK4)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,3)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,3)
END
goto BEGIN
:CHECK5CLICK
IF @dlgtext(CHECK5)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,4)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,4)
END
goto BEGIN
:CHECK6CLICK
IF @dlgtext(CHECK6)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,5)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,5)
END
goto BEGIN
:CHECK7CLICK
IF @dlgtext(CHECK7)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,6)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,6)
END
goto BEGIN
:CHECK8CLICK
IF @dlgtext(CHECK8)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORT,7)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORT,7)
END
goto BEGIN
:CHECK9CLICK
IF @dlgtext(CHECK9)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORTB,0)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORTB,0)
END
goto BEGIN
:CHECK10CLICK
IF @dlgtext(CHECK10)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORTB,1)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORTB,1)
END
goto BEGIN
:CHECK11CLICK
IF @dlgtext(CHECK11)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORTB,2)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORTB,2)
END
goto BEGIN
:CHECK12CLICK
IF @dlgtext(CHECK12)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORTB,3)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORTB,3)
END
goto BEGIN
:CHECK13CLICK
IF @dlgtext(CHECK13)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORTB,4)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORTB,4)
END
goto BEGIN
:CHECK14CLICK
IF @dlgtext(CHECK14)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORTB,5)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORTB,5)
END
goto BEGIN
:CHECK15CLICK
IF @dlgtext(CHECK15)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORTB,6)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORTB,6)
END
goto BEGIN
:CHECK16CLICK
IF @dlgtext(CHECK16)
%A = @LIB(io.dll,SetPortBit,BOOL:,%%PORTB,7)
ELSE
%A = @LIB(io.dll,ClrPortBit,BOOL:,%%PORTB,7)
END
goto BEGIN

:CLOSE
rem :Start
rem %B = @LIB(io.dll,PortOut,INT,%%PORT,776)
rem wait .1
rem %B = @LIB(io.dll,PortOut,INT,%%PORT,780)
rem wait .1
rem goto Start
FREELIB io.dll
EXIT
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group