Board index » delphi » Parallel port control

Parallel port control

I NEED a Turbo pascal unit (.pas / .tpu) for controlling the parallel /
linear port.

Thanks. a.ku...@hccnet.nl

 

Re:Parallel port control


Which operating system?
Quote
"Aldert Kuijn" <a.ku...@hccnet.nl> wrote in message news:a24nd3$fo5$1@news.hccnet.nl...
> I NEED a Turbo pascal unit (.pas / .tpu) for controlling the parallel /
> linear port.

> Thanks. a.ku...@hccnet.nl

Re:Parallel port control


In DOS, I prefer.

Rufus V. Smith <nospam@nospam> schreef in berichtnieuws
3c45f167$0$10988$4c410...@reader0.ash.ops.us.uu.net...

Quote
> Which operating system?

> "Aldert Kuijn" <a.ku...@hccnet.nl> wrote in message

news:a24nd3$fo5$1@news.hccnet.nl...
Quote
> > I NEED a Turbo pascal unit (.pas / .tpu) for controlling the parallel /
> > linear port.

> > Thanks. a.ku...@hccnet.nl

Re:Parallel port control


"Aldert Kuijn" <a.ku...@hccnet.nl> schreef in bericht
news:a2bfl9$a09$1@news.hccnet.nl...

Quote
> In DOS, I prefer.

> Rufus V. Smith <nospam@nospam> schreef in berichtnieuws
> 3c45f167$0$10988$4c410...@reader0.ash.ops.us.uu.net...
> > Which operating system?

> > "Aldert Kuijn" <a.ku...@hccnet.nl> wrote in message
> news:a24nd3$fo5$1@news.hccnet.nl...
> > > I NEED a Turbo pascal unit (.pas / .tpu) for controlling the
parallel /
> > > linear port.

> > > Thanks. a.ku...@hccnet.nl

I don't know what you mean with a linear port. If you mean that you have
a measurement card in your computer it is probably something you should
find out using the manufacturers specifications. Normally these cards are
accessible at a certain hardware address. In order to acces the measured
voltage you can normally use the MEM, MEMW or MEML arrays to get or to
put a value to the card.
If you meant the serial ports, I can advice

  COMM_TP5.ZIP

Just search for it on any download site.

BP/TP suppots accessing the parrallel port through a file variabele.
The standard PRINTER unit is what you need. Or you can access the port
through a textfile variabele yourself by assigning it to LPT1.

The following example is more than 20 years old. It produces a screendump
of the graphic screen to the printer port suitable for a needle printer.

-- Femme Verbeek

uses dos,printer,graph;

procedure hardcopy(inverse:boolean;mode:byte); { EPSON Printer}

  var gi,gj,top:integer;
      ColorLoc,PrintByte:byte;

  Procedure sendbyte(B : byte);     {send one byte to printer}
  const Lptportnum = 1;
  var Regs :registers ;
  begin
    Regs.ah := 0;
    Regs.al := B;
    regs.dx := Pred(Lptportnum);
    intr($17,regs);
  end;

  function pd(x,y:integer):boolean;
    begin
      pd:=not(GetPixel(x,y)=0);
    end;

  procedure doline(top:integer);

    function ConstructByte(tj,ti:integer):byte;
      const Bits:array [0..7] of byte=(128,64,32,16,8,4,2,1);
      var CByte,k:byte;
      begin {constructbyte}
        ti:=ti shl 3;
        CByte:=0;
        for k:=0 to top do
          if PD(tj,ti+k) then CByte:=CByte or Bits[k];
        ConstructByte:=CByte;
      end;{constructbyte}

    var li,lj:integer;

    begin {doline}
      if mode=1 then write(lst,#27'L')
      else write(lst,#27'*',chr(mode));
      write(lst,chr(lo(getMaxX+1)),chr(Hi(getMaxX+1)));
      for lj :=0 to getmaxx do {getmaxx}
       begin
        PrintByte:=ConstructByte(lj,gi);
        if inverse then PrintByte:=not PrintByte;
        sendbyte(PrintByte);
       end;
{      if mode<>4 then} writeln(lst);
    end;{doline}

  begin{hardcopy}
    top:=7;
    ColorLoc:=getColor;
    setColor(255);
    mode:=mode and 7;
    if (mode=5) or (mode=0) then mode:=4;
    write(lst,#27'3'#24);
    for gi:=0 to ((getMaxY+1) shr 3)-1 do doline(7);
    gi:=((getMaxY+1) shr 3);
    if (getMaxY+1) and 7<>0 then
      doline((getMaxY+1) and 7);
    writeln(lst,^['2');
    setColor(ColorLoc);
  end;

Re:Parallel port control


Really, thanks for your help!

Femme Verbeek <See.signature....@my.emailadress> schreef in berichtnieuws
u4j5v8280e3...@corp.supernews.com...

Quote

> "Aldert Kuijn" <a.ku...@hccnet.nl> schreef in bericht
> news:a2bfl9$a09$1@news.hccnet.nl...
> > In DOS, I prefer.

> > Rufus V. Smith <nospam@nospam> schreef in berichtnieuws
> > 3c45f167$0$10988$4c410...@reader0.ash.ops.us.uu.net...
> > > Which operating system?

> > > "Aldert Kuijn" <a.ku...@hccnet.nl> wrote in message
> > news:a24nd3$fo5$1@news.hccnet.nl...
> > > > I NEED a Turbo pascal unit (.pas / .tpu) for controlling the
> parallel /
> > > > linear port.

> > > > Thanks. a.ku...@hccnet.nl

> I don't know what you mean with a linear port. If you mean that you have
> a measurement card in your computer it is probably something you should
> find out using the manufacturers specifications. Normally these cards are
> accessible at a certain hardware address. In order to acces the measured
> voltage you can normally use the MEM, MEMW or MEML arrays to get or to
> put a value to the card.
> If you meant the serial ports, I can advice

>   COMM_TP5.ZIP

> Just search for it on any download site.

> BP/TP suppots accessing the parrallel port through a file variabele.
> The standard PRINTER unit is what you need. Or you can access the port
> through a textfile variabele yourself by assigning it to LPT1.

> The following example is more than 20 years old. It produces a screendump
> of the graphic screen to the printer port suitable for a needle printer.

> -- Femme Verbeek

> uses dos,printer,graph;

> procedure hardcopy(inverse:boolean;mode:byte); { EPSON Printer}

>   var gi,gj,top:integer;
>       ColorLoc,PrintByte:byte;

>   Procedure sendbyte(B : byte);     {send one byte to printer}
>   const Lptportnum = 1;
>   var Regs :registers ;
>   begin
>     Regs.ah := 0;
>     Regs.al := B;
>     regs.dx := Pred(Lptportnum);
>     intr($17,regs);
>   end;

>   function pd(x,y:integer):boolean;
>     begin
>       pd:=not(GetPixel(x,y)=0);
>     end;

>   procedure doline(top:integer);

>     function ConstructByte(tj,ti:integer):byte;
>       const Bits:array [0..7] of byte=(128,64,32,16,8,4,2,1);
>       var CByte,k:byte;
>       begin {constructbyte}
>         ti:=ti shl 3;
>         CByte:=0;
>         for k:=0 to top do
>           if PD(tj,ti+k) then CByte:=CByte or Bits[k];
>         ConstructByte:=CByte;
>       end;{constructbyte}

>     var li,lj:integer;

>     begin {doline}
>       if mode=1 then write(lst,#27'L')
>       else write(lst,#27'*',chr(mode));
>       write(lst,chr(lo(getMaxX+1)),chr(Hi(getMaxX+1)));
>       for lj :=0 to getmaxx do {getmaxx}
>        begin
>         PrintByte:=ConstructByte(lj,gi);
>         if inverse then PrintByte:=not PrintByte;
>         sendbyte(PrintByte);
>        end;
> {      if mode<>4 then} writeln(lst);
>     end;{doline}

>   begin{hardcopy}
>     top:=7;
>     ColorLoc:=getColor;
>     setColor(255);
>     mode:=mode and 7;
>     if (mode=5) or (mode=0) then mode:=4;
>     write(lst,#27'3'#24);
>     for gi:=0 to ((getMaxY+1) shr 3)-1 do doline(7);
>     gi:=((getMaxY+1) shr 3);
>     if (getMaxY+1) and 7<>0 then
>       doline((getMaxY+1) and 7);
>     writeln(lst,^['2');
>     setColor(ColorLoc);
>   end;

Other Threads