DPRG List  

DPRG: Accessing the Parallel Port from BCB 1.0

Subject: DPRG: Accessing the Parallel Port from BCB 1.0
From: Elliot Johnson elliotj at geocities.com
Date: Mon Aug 16 22:10:59 CDT 1999

thanks for the help guys, i was able to get it working.  I just moved the assembly code to an external dll written in a different compiler and it worked fine.  The inportb and outportb functions don't working in bcb 1.0 for some reason.  the include file looks like they should still be declared, they aren't in a  #ifndef _WINDOWS_ block so they should still be included but something is cutting them out.


Rivers wrote:

> 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