DPRG
DPRG List  



DPRG: Accessing the Parallel Port from BCB 1.0

Subject: DPRG: Accessing the Parallel Port from BCB 1.0
From: Rivers rivers5 at home.com
Date: Sun Aug 15 22:28:34 CDT 1999

Elliot,

You don't have to use assembler to access the parallel port.  Here is a
small example of Borland C that accesses a parallel port:

    cc = inportb(0x379) & 0x80;   // read parallel port bit 80
    if (cc)
	{
	outportb(0x378, mychan);  // write to parallel port
	delay(750);
	outportb(0x378, 0);
	}

Use of "inportb" (in port byte) and "outportb" (out port byte) require a
#define dos.h

- -Ed R.


Elliot Johnson wrote:
> 
> I am having trouble accessing the parallel port from borland c++ builder 1.0.   I can't find any library functions to do it.  I have tried this assembly code
> 
> asm mov dx, Port
> asm mov al, Value
> asm out dx,al
> asm pop dx
> 
> But i always get a linker error and have to restart borland before it will be able to compile again with the assembly code commented out.  any help would be appreciated, I managed to get my hands on a very basic very small lathe and wrote some nice control software to run the two stepper motors that run it. Its all finished except for this most important part of writing to the parallel port.
> 
> later,
> Elliot

------------------------------

More information about the DPRG mailing list