Parallel port control 
Author Message
 Parallel port control

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




Mon, 05 Jul 2004 04:21:43 GMT  
 Parallel port control
Which operating system?
Quote:

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





Mon, 05 Jul 2004 05:05:32 GMT  
 Parallel port control
In DOS, I prefer.



Quote:
> Which operating system?




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





Wed, 07 Jul 2004 17:52:24 GMT  
 Parallel port control



Quote:
> In DOS, I prefer.



> > Which operating system?



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



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;



Wed, 07 Jul 2004 23:55:05 GMT  
 Parallel port control
Really, thanks for your help!



Quote:



> > In DOS, I prefer.



> > > Which operating system?



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


> 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;



Thu, 08 Jul 2004 18:54:46 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. PC Parallel port control

2. Parallel Port LED Controlling

3. Parallel Port LED Controlling

4. Turbo Pascal v7.0 -- Controlling Parallel/Serial Port bits

5. Reading a parallel port

6. Redefine the parallel port?

7. Parallel port success!!!!

8. BE: Re: parallel port for data acquisition

9. parallel port for data acquisition

10. Need help with getting data from parallel port

11. Parallel port for data acquisition....Continue!

12. About parallel port....

 

 
Powered by phpBB® Forum Software