×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Printer port as analog switch (all on/all off) io

Printer port as analog switch (all on/all off) io

Printer port as analog switch (all on/all off) io

(OP)
Hello,

How would I go about turning all of the pins on my printer port on at the same time?  I need to use it as an analog switch. I am adapting a program to interface with some lab equipment usind an A/D converter.  Essentially, I need to make the port come on and stay on until the program cyles.

Thank You

qb101
qb101@oscartrapp.com

RE: Printer port as analog switch (all on/all off) io

'The following code will allow you to toggle the pins on LPT1:

A% = 0
OUT &H378, &H0
PRINT "Press `X' to quit"
start: A$ = INKEY$
IF A$ = "" THEN GOTO start
IF A$ = "1" THEN A% = A% XOR &H1
IF A$ = "2" THEN A% = A% XOR &H2
IF A$ = "3" THEN A% = A% XOR &H4
IF A$ = "4" THEN A% = A% XOR &H8
IF A$ = "5" THEN A% = A% XOR &H10
IF A$ = "6" THEN A% = A% XOR &H20
IF A$ = "7" THEN A% = A% XOR &H40
IF A$ = "8" THEN A% = A% XOR &H80
IF A$ = "X" OR A$ = "x" THEN END
OUT &H378, A%
GOTO start



 
Kim_Christensen@telus.net
http://www3.bc.sympatico.ca/Kim_Christensen/index.html
 

RE: Printer port as analog switch (all on/all off) io

By the way, that code could be rewritten as follows:

value% = 0
DO
 OUT
&H378, value%
 a$ = INPUT$(1)
 value% = value% XOR (2 ^ (VAL(a$) - 1))
LOOP UNTIL LCASE$(a$) = "x"


Much more compact Though admittedly less readable to the unaccustomed reader.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close