• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
November 23, 2024, 05:01:54 am

News:

SMF - Just Installed!


LPT port base addresses?

Started by chedges, April 27, 2009, 01:37:38 pm

Previous topic - Next topic

chedges

Hi Roman,

Can you offer me some advice on how to determine the base address of the LPT ports.
The below code workds fine on my machine but obviously doesn't work on machines where the
base address is different

   if not nrLPT1.Active then
    begin
      nrLPT1.LptIOBase := 888; {todo: This could be different, how do we work this out on the fly}
      nrLPT1.LptPortNo :=  1;
      nrLPT1.Active := True;
    end;

how can I work what the base address should be? I've looked on a few forums and done some searches
but I've not found a solution yet :(




Roman Novgorodov

Hello

Please try to change base address AFTER select port number.

if not nrLPT1.Active then
    begin
      nrLPT1.LptPortNo :=  1;
      nrLPT1.LptIOBase := $378; // or $278
      nrLPT1.Active := True;
    end;

Ordinary LPT1 and LPT2 have 378h and 278h addresses.

If you are using specific PCI multiport card, please read its manual.

Roman Novgorodov
DeepSoftwae.Com

DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

April 27, 2009, 07:51:10 pm #2 Last Edit: April 28, 2009, 04:47:49 am by chedges
Hi Roman,

thanks for the quick reply :)

How do I know what base address to specify? Do I even need to specify a base address?

The reason I ask is because I have tested some software on a number of laptops to which the base address is different from my own machine. The software will not work because of this. Can I tell what base address to use for LPT1, 2 etc and set it at run time?

is this stored in the registry somewhere?

Thanks again,

Chris

btw, here is the port config of a laptop that is using a base address very different to my machine



chedges

Hi Again,

I thought I'd try using the ntDeviceBox connected to the nrLPT component to see if that sets the base address of the port when you select LPT1 etc.
It doesn't seem to as I'm getting a "Base I/O address is NULL" error.

Should this set the base address or is this component only for selecting the actual port?

Roman Novgorodov

Hello

I'm sorry.
It seems like the email notifications from forum are blocked by f**ked ANTI spam filters. >:(
Therefore I see your new message so later.

Information from Device Manager can not be used for correct detection of I/O port number.
Please see new screenshot from my PC:


The TnrLpt component tries to detect I/O port during enumeration process. This value is available in
TnrLpt.Device[].DataEx property. But please note that this can be detected wrong :-(

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

Thanks Roman,

I knew you would get round to this soon as you were able :)

So, is there no sure-fire way of working out the base address? It seems to be a subject with virtually no information on the net.

Damn you Microsoft!!!!! :)

Roman Novgorodov

Hello

What number do you see in nrLpt1.Device[0].DataEx property?
Is it wrong value?

Roman Novgorodov
DeepSoftware
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

Hi Roman,

Sorry for the HUGE delay in replying to this, I've had to work on another project but now I'm back onto this ;)


My machine only has one LPT port so inspecting the .Device[0].DataEx property returns 1 as the value?
The actual base address I use for this LPT port is 888.

Any idea why the DataEx is not reporting the correct value?


Roman Novgorodov

Hello

Unfortunately, this feature (detection of IO port number) is undocumented.
Possible your driver does not place needed infomration into registry.

What version of Windows are you using?
We will check all again.

Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

HI Roman,

I'm using WinXP Sp3.

chedges

HI Again :)

I think the base address issue is hiding a more serious problem for me.

I'm using 2 laptops, both WinXP sp3. one machine has a LPT1 with a base address of 378H (888 decimal)
and the other has a LPT1 with a base address of 3BCH (956 decimal)

I have confirmed both laptops are able to print to the LPT1 port by using a COPY CON LPT1: command from the command prompt.
Both laptops are able to print and there are no other applications or printer drivers using the LPT ports.

I have made a very simple app which allows me to set the base address, see below

nrLPT1.DeviceIndex := nrDeviceBox1.ItemIndex;
nrLPT1.LptIOBase := StrToInt(edit1.Text); //ether 888 or 956 depending on the laptop used.
nrLPT1.Active := True;
nrLPT1.SendString('Testing the LPT<p>');
nrLPT1.Active := False;

On the first laptop with the base address of 378H, setting the LPTIOBase to 888, the data will be sent to the printer
and print correctly. If I perform the same test on the second laptop, setting the LPTIOBase to 956, the data will be
sent to the printer but nothing happens.

I've tried this on a number of different machines and it only seems to print correctly if the machines LPT port base address is 378H (888) and fails on the others, regardless if I set the Base address to the correct value.

Do have you any idea why this might be the case? This is a pretty serious issue for me :(


Thanks again for your help,

Chris.

Roman Novgorodov

Hello

We I have checked. Base port number is used correctly in TnrLpt component.

It seems like you need to set correct values in some of the control pins of LPT port (nrLpt1.Pins[])
You can modify LPTDemo for enter the new number of Base Port ($3BC) and try to play with pins before try SendString().

Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

June 10, 2009, 01:19:00 am #12 Last Edit: June 10, 2009, 01:20:43 am by chedges
Hi Roman,

I've tried the LPTDemo on the two machines and have added a edit to allow the base address to be specified.

Below are screenshots when the application is run and the port activated. The printer is attached and ready to print in both
tests.

The Left image is of the machine that is able to print and the right image is of the machine that is not.
On the machine that cannot print, all of the data pins are high? If I uncheck any of the data pins and then refresh, they
return to their checked state

I'm not quite sure what the pins are telling me, can you see anything from the screenshots?


Roman Novgorodov

Hello

It seems like LPT port on your second laptop does not work properly.
Possible it is hardware error, possible problem is in system driver.
The 3BCh is very unusual number. In most cases it is obsolete value.

Can you try to enter into BIOS setup and change base port from 3BC to 37F ?
Also you can play with default LPT modes in BIOS of your PC (ECP\EPP\IEEE 1284).

Roman Novgorodov


DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

chedges

I think the 3BC base address is fairly common.

I've tested the other addresses available from the BIOS (3BC and 278)
these both display similar behaviour with the pins as the 3BC address.

only when set to 3BC will the printer print when I test from the
command prompt or using a generic printer driver attached to LPT1.

I'm 100% certain the printer and port hardware is working OK but I just don't
understand why the nrLPT component doesn't seem to like it ???