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?
Didn't find your answer? Ask the community — no account required.
P
petrus bitbyter
"rick" schreef in bericht news: snipped-for-privacy@g44g2000cwa.googlegroups.com...
See
formatting link
on the subject of parallel port interfacing.
petrus bitbyter
S
Spehro Pefhany
Also, Jan Axelson's web page at
formatting link
Best regards, Spehro Pefhany
"it\'s the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
T
Tim Wescott
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
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
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
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.
Paul Burke
J
Jem Berkes
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.
Jem Berkes
Software design for Windows and Linux/Unix-like systems
http://www.sysdesign.ca/
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.