parallel port output problem

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?

Reply to
rick
Loading thread data ...

"rick" schreef in bericht news: snipped-for-privacy@g44g2000cwa.googlegroups.com...

See

formatting link
on the subject of parallel port interfacing.

petrus bitbyter

Reply to
petrus bitbyter

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
 Click to see the full signature
Reply to
Spehro Pefhany

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
 Click to see the full signature
Reply to
Tim Wescott

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

Reply to
petrus bitbyter

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.

Reply to
budgie

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

Reply to
Paul Burke

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
 Click to see the full signature
Reply to
Jem Berkes

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.