Board index » delphi » Accessing Parallel Ports

Accessing Parallel Ports

Hi,

I am an amateur Delphi Programmer. I am running Win95 and using Delphi3.

I have built a circuit that attaches to the printer port and is driven by
the little program below (Extract of relevant procedures)...

procedure WritePort( wPort : Word; bValue : Byte );

begin
  asm
    mov dx, wPort
    mov al, bValue
    out dx, al
  end;
end;

Procedure Writedata;

Begin
  WritePort($378,$80); (* Base address of Printer port $378 *)
End;

The WritePort() function is from the net that I downloaded and assumed that
the person who
provided the tip had used it successfully.

When WriteData is called it should As far as I can see put a high (1)
on pin 9 of the Printer port but it does not.

The program does not crash it excuted the commands but nothing happens!!!

Are the port addresses changed in 95? What am I doing wrong?

Please if someone could help me with what I am doing wrong or point me in
the right direction.

Regards
Patrick

 

Re:Accessing Parallel Ports


In article <3616e86...@cactus.highway1.com.au>, "Patrick Clift"

Quote
<pcl...@dana.wanet.com.au> writes:
>Begin
>  WritePort($378,$80); (* Base address of Printer port $378 *)
>End;

>The WritePort() function is from the net that I downloaded and assumed that
>the person who
>provided the tip had used it successfully.

>When WriteData is called it should As far as I can see put a high (1)
>on pin 9 of the Printer port but it does not.

Check that you are sending to the address contained (in reverse word order) at
$0408 (read it with code, or use DOS debug).

You may also have to link pin 13 of your LPT1 connector to a high level to
indicate that the "printer" is on line.

Alan Lloyd
alangll...@aol.com

Re:Accessing Parallel Ports


Quote
>When WriteData is called it should As far as I can see put a high (1)
>on pin 9 of the Printer port but it does not.

Be careful - the port hardware inverts some of the control and status bits
at the connector - if you write a 'one', you see a 'zero'.  I don't have the
port bits in front of me, but instead of just setting the bit high, try
toggling it high/low with a one second pause between, then you'll be able to
see if your actually writing to the port.

--
Dave White
Spectrachrom Software
web site : http://www.spectrachrom.com
e-mail : spec...@spectrachrom.com

Re:Accessing Parallel Ports


Step 1: check to see if the code is working
     1) send an ascii "A" out the port with it attached to a printer - do
this multiple times  - see if it prints.
     2) check to make sure that the printer driver in windows is not holding
the io port and spooling the commands.
     3) check the flow control pins for proper signal levels such that the
port will transfer data to the card. (Try The Hardware Bible).

You may want to just let windows manage the io by using the generic printer
driver with spooling turned off.  this will allow the output to go directly
to the card.

Quote
Patrick Clift wrote in message <3616e86...@cactus.highway1.com.au>...
>Hi,

>I am an amateur Delphi Programmer. I am running Win95 and using Delphi3.

>I have built a circuit that attaches to the printer port and is driven by
>the little program below (Extract of relevant procedures)...

>procedure WritePort( wPort : Word; bValue : Byte );

>begin
>  asm
>    mov dx, wPort
>    mov al, bValue
>    out dx, al
>  end;
>end;

>Procedure Writedata;

>Begin
>  WritePort($378,$80); (* Base address of Printer port $378 *)
>End;

>The WritePort() function is from the net that I downloaded and assumed that
>the person who
>provided the tip had used it successfully.

>When WriteData is called it should As far as I can see put a high (1)
>on pin 9 of the Printer port but it does not.

>The program does not crash it excuted the commands but nothing happens!!!

>Are the port addresses changed in 95? What am I doing wrong?

>Please if someone could help me with what I am doing wrong or point me in
>the right direction.

>Regards
>Patrick

Re:Accessing Parallel Ports


Step 1: check to see if the code is working
     1) send an ascii "A" out the port with it attached to a printer - do
this multiple times  - see if it prints.
     2) check to make sure that the printer driver in windows is not holding
the io port and spooling the commands.
     3) check the flow control pins for proper signal levels such that the
port will transfer data to the card. (Try The Hardware Bible).

You may want to just let windows manage the io by using the generic printer
driver with spooling turned off.  this will allow the output to go directly
to the card.

Quote
Patrick Clift wrote in message <3616e86...@cactus.highway1.com.au>...
>Hi,

>I am an amateur Delphi Programmer. I am running Win95 and using Delphi3.

>I have built a circuit that attaches to the printer port and is driven by
>the little program below (Extract of relevant procedures)...

>procedure WritePort( wPort : Word; bValue : Byte );

>begin
>  asm
>    mov dx, wPort
>    mov al, bValue
>    out dx, al
>  end;
>end;

>Procedure Writedata;

>Begin
>  WritePort($378,$80); (* Base address of Printer port $378 *)
>End;

>The WritePort() function is from the net that I downloaded and assumed that
>the person who
>provided the tip had used it successfully.

>When WriteData is called it should As far as I can see put a high (1)
>on pin 9 of the Printer port but it does not.

>The program does not crash it excuted the commands but nothing happens!!!

>Are the port addresses changed in 95? What am I doing wrong?

>Please if someone could help me with what I am doing wrong or point me in
>the right direction.

>Regards
>Patrick

Other Threads