Maker Pro
Maker Pro

parallel port output problem

R

rick

Jan 1, 1970
0
Hello,

I am a beginner in c programming. I am using turbo C. I need to
assign one or zero to a parallel port of my laptop. I was wondering if
I can use

outportb (0x3BC, 0x00);

If I am using a desktop parallel port or a laptop parallel port? Does
it matter?
 
P

petrus bitbyter

Jan 1, 1970
0
rick said:
Hello,

I am a beginner in c programming. I am using turbo C. I need to
assign one or zero to a parallel port of my laptop. I was wondering if
I can use

outportb (0x3BC, 0x00);

If I am using a desktop parallel port or a laptop parallel port? Does
it matter?

See http://www.beyondlogic.org/
on the subject of parallel port interfacing.

petrus bitbyter
 
T

Tim Wescott

Jan 1, 1970
0
rick said:
Hello,

I am a beginner in c programming. I am using turbo C. I need to
assign one or zero to a parallel port of my laptop. I was wondering if
I can use

outportb (0x3BC, 0x00);

If I am using a desktop parallel port or a laptop parallel port? Does
it matter?
Petrius and Spehro gave you the solutions, but not the problem explanation.

What you propose would have worked perfectly in DOS, or on a machine
that is running in 'real' mode. Your problem is that if you have any OS
later than Windows 2.x (OK, maybe 3.x) the OS will intercept the output
instruction and whang you with a big illegal access exception. IIRC the
page that Spehro pointed you to will give you a driver that intercepts
the output to the port then outputs the byte to the port. It's kind of
like trying to go take a pee when you're in 5th grade -- you need a hall
pass, which is what the driver provides.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google? See http://cfaj.freeshell.org/google/
 
P

petrus bitbyter

Jan 1, 1970
0
Tim Wescott said:
Petrius and Spehro gave you the solutions, but not the problem
explanation.

What you propose would have worked perfectly in DOS, or on a machine that
is running in 'real' mode. Your problem is that if you have any OS later
than Windows 2.x (OK, maybe 3.x) the OS will intercept the output
instruction and whang you with a big illegal access exception. IIRC the
page that Spehro pointed you to will give you a driver that intercepts the
output to the port then outputs the byte to the port. It's kind of like
trying to go take a pee when you're in 5th grade -- you need a hall pass,
which is what the driver provides.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google? See http://cfaj.freeshell.org/google/


I'm sorry I missed some news. My current (third) ISP also has no reliable
newsservers. (Sigh.)

You're only partial right about Windows. I wrote a lot of C programs using
Turbo C using direct I/O to UARTS and printerports. All of them did well
when running W95. I was told they did so too running W98 and Wmil but I did
not check that out myself. They will sure not function running W2k or WXP.
The old Turbo C is not the right tool to write programs for that OSes.

petrus bitbyter
 
B

budgie

Jan 1, 1970
0
Petrius and Spehro gave you the solutions, but not the problem explanation.

What you propose would have worked perfectly in DOS, or on a machine
that is running in 'real' mode. Your problem is that if you have any OS
later than Windows 2.x (OK, maybe 3.x) the OS will intercept the output
instruction and whang you with a big illegal access exception.

Tim, you've spent too much time with NT-based O/Ses. That HAL-interception is a
feature of those, but Win9x doesn't have that problem. I do extensive parallel
port I/O under 98SE and don't have any dramas. The only caveat is that if
Windoze gets to use the port first, it soemtimes keeps some sort of hold over
it.

And to the O/P - the short answer is yes.
 
P

Paul Burke

Jan 1, 1970
0
Tim said:
What you propose would have worked perfectly in DOS, or on a machine
that is running in 'real' mode. Your problem is that if you have any OS
later than Windows 2.x (OK, maybe 3.x) the OS will intercept the output
instruction and whang you with a big illegal access exception.

No, he'll be fine in W95,98 and Me. He'll also be OK in NT, 2000 and XP
if he installs the (free) giveio.sys utility or one of several others of
a similar nature.

<http://www.cs.ucr.edu/~eblock/pages/pictools/giveio.html>

Paul Burke
 
J

Jem Berkes

Jan 1, 1970
0
I am a beginner in c programming. I am using turbo C. I need to
assign one or zero to a parallel port of my laptop. I was wondering if
I can use

outportb (0x3BC, 0x00);

If I am using a desktop parallel port or a laptop parallel port? Does
it matter?

As others have mentioned, you have to check to see if your operating system
will let you output data like this straight to the parallel port. It can be
done under Linux with root privileges and a system call to get parallel
port access, IIRC.

Even if you're under an older Windows that allows direct access to
hardware, check very carefully for any other drivers such as printers or
scanners that might interfere with your parallel port experiments. This
happened to me, and I was pulling out my hair when all that was happening
was interference with a system driver that used the parallel port.
 
Top