Printer Port

W

Wong

Guest
Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.
 
Wong wrote:
Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.
I often have more than one printer and printer port
on a computer.
 
"Bill Vajk" <bill9north@hotmailDITCHTHIS.com> wrote in message
news:uvOdneqN0PWgaD_dRVn-gw@comcast.com...
Wong wrote:
Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.

I often have more than one printer and printer port
on a computer.
Wong answer LOL
 
Tim Kettring wrote:
"Bill Vajk" <bill9north@hotmailDITCHTHIS.com> wrote in message
news:uvOdneqN0PWgaD_dRVn-gw@comcast.com...

Wong wrote:

Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.

I often have more than one printer and printer port
on a computer.

Wong answer LOL
Works for me.
 
"Wong" <tatto0_2000@yahoo.com> wrote in message
news:509bfe22.0405121950.1a927c85@posting.google.com...
Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A
?
I am confuse and hope someone can shed me a light.
Thanks.

All these hardware addresses can be used by printer adapters
and at boot time the Operating system checks to see which
are present and allocates them to LPT1 then 2 then 3 as
they are found.
--
John G

Wot's Your Real Problem?
 
Bill Vajk wrote:
Tim Kettring wrote:
"Bill Vajk" <bill9north@hotmailDITCHTHIS.com> wrote in message
news:uvOdneqN0PWgaD_dRVn-gw@comcast.com...

Wong wrote:

Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.

I often have more than one printer and printer port
on a computer.

Wong answer LOL

Works for me.
---------------
WRONGO! 378 is the Hex address of the data byte (D0-D7) on LPT port
pins 2 thru 9. The ports 379 Hex and 37A Hex are the +1and +2 offset
ports for LPT1 that control the other pins, 379 reads the pins
10 thru 13 and 15 status bits (S7-S3) as inputs, and 37A writes to
the pins 1, 14, 16, 17, the Control bits C0 thru C3.

Now a few of these are inverted, and the control pins are open
collector, so that they can be read back from the same address.

Use this diagram to determine this:

http://www.armory.com/~rstevew/Public/LPT/parallel.gif

S7 and C3, C1, and C0 are inverted.

The other alternate LPT2 and LPT3 addresses have base (Data byte)
addresses starting at 278 Hex and 3BC hex, and each has two more
+1 and +2 offset ports as well for their Status and Control pins.

-Steve
--
-Steve Walz rstevew@armory.com ftp://ftp.armory.com/pub/user/rstevew
Electronics Site!! 1000's of Files and Dirs!! With Schematics Galore!!
http://www.armory.com/~rstevew or http://www.armory.com/~rstevew/Public
 
John G wrote:
"Wong" <tatto0_2000@yahoo.com> wrote in message
news:509bfe22.0405121950.1a927c85@posting.google.com...
Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A
?
I am confuse and hope someone can shed me a light.
Thanks.

All these hardware addresses can be used by printer adapters
and at boot time the Operating system checks to see which
are present and allocates them to LPT1 then 2 then 3 as
they are found.
--
John G

Wot's Your Real Problem?
-------------
No, the port base addresses are 378, 278, and 3BC Hex.

The addresses 379 and 37A Hex are the other two addresses
that are part of the LPT1 port at 378 Hex.

-Steve
--
-Steve Walz rstevew@armory.com ftp://ftp.armory.com/pub/user/rstevew
Electronics Site!! 1000's of Files and Dirs!! With Schematics Galore!!
http://www.armory.com/~rstevew or http://www.armory.com/~rstevew/Public
 
"Wong" <tatto0_2000@yahoo.com> wrote in message
news:509bfe22.0405121950.1a927c85@posting.google.com...
Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.
When 378 is used as the data register for a printer port (LPT1), then 379 is
usually a status register and 37A a control register.

It is also posible to use more port-triples for added printers. 278-27A are
commonly used for LPT2.
 
"R. Steve Walz" <rstevew@armory.com> wrote in message
news:40A30A36.1E91@armory.com...
John G wrote:

"Wong" <tatto0_2000@yahoo.com> wrote in message
news:509bfe22.0405121950.1a927c85@posting.google.com...
Hi,
Address of 378 is normally define for printer port,
LPT.
Then what is the purpose to use the address of 379,
37A
?
I am confuse and hope someone can shed me a light.
Thanks.

All these hardware addresses can be used by printer
adapters
and at boot time the Operating system checks to see
which
are present and allocates them to LPT1 then 2 then 3 as
they are found.
--
John G

Wot's Your Real Problem?
-------------
No, the port base addresses are 378, 278, and 3BC Hex.

The addresses 379 and 37A Hex are the other two addresses
that are part of the LPT1 port at 378 Hex.

-Steve

You are absolutly correct.
It is so long since I needed to care about this I jumped to
the wrong conclusion.
But 378H will only be LPT1 if there is something there.
If 278H is the hardware address of the only print adapter
the it will become LPT1
This may be rare but it did confuse many people long ago.
(Remember DOS)
The Monchrome and Print adapter had one address and the
Print adapter had another.
--
John G

Wot's Your Real Problem?
 
R. Steve Walz wrote:
John G wrote:

"Wong" <tatto0_2000@yahoo.com> wrote in message
news:509bfe22.0405121950.1a927c85@posting.google.com...

Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A
?

I am confuse and hope someone can shed me a light.

Thanks.

All these hardware addresses can be used by printer adapters
and at boot time the Operating system checks to see which
are present and allocates them to LPT1 then 2 then 3 as
they are found.
--
John G

Wot's Your Real Problem?

-------------
No, the port base addresses are 378, 278, and 3BC Hex.
That's what I misread into the question. I guess I'll
just have to go punish myslef. LOL

The addresses 379 and 37A Hex are the other two addresses
that are part of the LPT1 port at 378 Hex.
 
In news:uvOdneqN0PWgaD_dRVn-gw@comcast.com,
Bill Vajk typed:
Wong wrote:
Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.

I often have more than one printer and printer port
on a computer.
The second port would be at 278 to 27A. The first port is at 378 to
37A. That's assuming it's an old-style port that uses 3 addresses. Of
course ECP uses DMA and I don't know off-hand how many I/O addresses.


--
-Reply in group, but if emailing add 2 more zeros-
-and remove the obvious-
 
In news:509bfe22.0405121950.1a927c85@posting.google.com,
Wong typed:
Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.

VIEW IN A FIXED-WIDTH FONT:


378H-37fH Parallel Printer Adapter #1
3bcH is base of MDPA
278H is base of printer adapter #2
378H Printer Data Latch.
Write: send byte to printer
Read: fetch last byte sent

37aH Read/Write: Printer Controls
+7-6-5-4-3-2-1-0+
Ś0 0 0Ś Ś Ś Ś Ś Ś
+---------------+ bit
Ś Ś Ś Ś +- 0: +Strobe (pin 1) 1 when sending byte
Ś Ś Ś +--- 1: +AUTO LineFeed (pin 14) 1 causes LF after CR
Ś Ś +----- 2: -INIT (pin 16) 0 resets the printer
Ś +------- 3: +SLCT IN (pin 17) 1 selects the
printer
+--------- 4: +IRQ Enable (hdwr INT when -ACK goes false)
LPT1-IRQ 7 (INT 0fH)
LPT2-IRQ 5 (INT 0dH)
379H Read-only: Printer Status
+7-6-5-4-3-2-1-0+
Ś Ś Ś Ś Ś Ś0 0 0Ś
+---------------+ bit
Ś Ś Ś Ś +------- 3: -ERROR (pin 15) 0=printer signals an error
Ś Ś Ś +--------- 4: +SLCT (pin 13) 1=printer is selected
Ś Ś +----------- 5: +PE (pin 12) 1=out of paper
Ś +------------- 6: -ACK (pin 10) 0=ready for next character
+--------------- 7: -BUSY (pin 11) 0=busy or offline or error



--
-Reply in group, but if emailing add 2 more zeros-
-and remove the obvious-
 
On a sunny day (12 May 2004 20:50:11 -0700) it happened tatto0_2000@yahoo.com
(Wong) wrote in <509bfe22.0405121950.1a927c85@posting.google.com>:

Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.
379 hex is actually also a part of the par port (registers), for example
bit 3 0x379 =pin 15 (ERROR) is there
In the old day par port was a 8255 PPI IIRC.
So a peek in the 8255 registers should show you something.
But things did become more complicated when PPC, ECP capable ports came.

If it makes any sense to you:
#define LPT1_BASE_ADDR0x378
#define LPT2_BASE_ADDR0x278
#define LPT3_BASE_ADDR0x3BC

/* Offsets from the base address for the various registers */
#define STATUS_OFFSET0x01
#define CONTROL_OFFSET0x02

/* define ECP register offsets */
#define ECP_DATA0x00/* Data Register*/
#define ECP_A_FIFO0x00/* ECP Address FIFO*/
#define ECP_DSR0x01/* Device Status Register*/
#define ECP_DCR0x02/* Device Control Register*/
#define ECP_C_FIFO0x400/* Compatiblity mode FIFO */
#define ECP_D_FIFO0x400/* ECP Data FIFO*/
#define ECP_T_FIFO0x400/* ECP Test FIFO*/
#define ECP_CNFG_A0x400/* Config Register A*/
#define ECP_CNFG_B0x401/* Config Register B*/
#define ECP_ECR0x402/* Extended Control Reg.*/

#define ECP_FIFO_SIZE16

/* define some constants for used by the hardcoded functions */
#define BASE_LPT1 LPT1_BASE_ADDR
#define DATA_LPT1(LPT1_BASE_ADDR)
#defineSTATUS_LPT1(LPT1_BASE_ADDR+STATUS_OFFSET)
#defineCONTROL_LPT1(LPT1_BASE_ADDR+CONTROL_OFFSET)
#defineDATA_FIFO_LPT1(LPT1_BASE_ADDR+ECP_D_FIFO)
#defineECR_LPT1(LPT1_BASE_ADDR+ECP_ECR)

#define BASE_LPT2 LPT2_BASE_ADDR
#define DATA_LPT2(LPT2_BASE_ADDR)
#defineSTATUS_LPT2(LPT2_BASE_ADDR+STATUS_OFFSET)
#defineCONTROL_LPT2(LPT2_BASE_ADDR+CONTROL_OFFSET)
#defineDATA_FIFO_LPT2(LPT2_BASE_ADDR+ECP_D_FIFO)
#defineECR_LPT2(LPT2_BASE_ADDR+ECP_ECR)

#define BASE_LPT3 LPT3_BASE_ADDR
#define DATA_LPT3(LPT3_BASE_ADDR)
#defineSTATUS_LPT3(LPT3_BASE_ADDR+STATUS_OFFSET)
#defineCONTROL_LPT3(LPT3_BASE_ADDR+CONTROL_OFFSET)
#defineDATA_FIFO_LPT3(LPT3_BASE_ADDR+ECP_D_FIFO)
#defineECR_LPT3(LPT3_BASE_ADDR+ECP_ECR)


#define WRITECTRL(portaddress,val)outb((BYTE )(val), (portaddress))
#define READDATA(portaddress)(BYTE )inb((portaddress))
#define READSTATUS(portaddress)(BYTE )inb((portaddress))


/* the following define the bits within the ECR register */
#define ECR_mode0xE0
#define ECR_nErrIntrEn0x10
#define ECR_dmaEn0x08
#define ECR_serviceIntr0x04
#define ECR_full0x02
#define ECR_empty0x01

#define ECP_STANDARD_MODE0x00
#define ECP_PS2_MODE0x20
#define ECP_FIFO_MODE0x40
#define ECP_ECP_MODE0x60
#define RESERVED_10x80
#define RESERVED_20xA0
#define ECP_TEST_MODE0xC0
#define ECP_CNFG_MODE0xE0

There is some info somehere on the Microsoft site about how ECP
protocol works, but I forgot immediatly after writing some of the code...
JP
 
"Tim Kettring" <tim6kettring@e-garfield.com> wrote in message news:<2ggb6fF2gpujU1@uni-berlin.de>...
"Bill Vajk" <bill9north@hotmailDITCHTHIS.com> wrote in message
news:uvOdneqN0PWgaD_dRVn-gw@comcast.com...


Wong wrote:
Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.

I often have more than one printer and printer port
on a computer.


Wong answer LOL
Yes, I don't think this is correct. Someone answered me in another
newgroup with the same wrong answer. Anyhow, thanks for the reply.
Thank you.
 
Sound so simple to manage par port since I can have direct control
over the signals. So if I have the following C code:
outp(37A, 0x04); // Would this reset the printer ?

data = inp (379); // Would this assign the status port signal level
to 'data' ?



"R. Steve Walz" <rstevew@armory.com> wrote in message news:<40A309D5.45B8@armory.com>...
Bill Vajk wrote:

Tim Kettring wrote:
"Bill Vajk" <bill9north@hotmailDITCHTHIS.com> wrote in message
news:uvOdneqN0PWgaD_dRVn-gw@comcast.com...

Wong wrote:

Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.

I often have more than one printer and printer port
on a computer.

Wong answer LOL

Works for me.
---------------
WRONGO! 378 is the Hex address of the data byte (D0-D7) on LPT port
pins 2 thru 9. The ports 379 Hex and 37A Hex are the +1and +2 offset
ports for LPT1 that control the other pins, 379 reads the pins
10 thru 13 and 15 status bits (S7-S3) as inputs, and 37A writes to
the pins 1, 14, 16, 17, the Control bits C0 thru C3.

Now a few of these are inverted, and the control pins are open
collector, so that they can be read back from the same address.

Use this diagram to determine this:

http://www.armory.com/~rstevew/Public/LPT/parallel.gif

S7 and C3, C1, and C0 are inverted.

The other alternate LPT2 and LPT3 addresses have base (Data byte)
addresses starting at 278 Hex and 3BC hex, and each has two more
+1 and +2 offset ports as well for their Status and Control pins.

-Steve
 
On 13 May 2004 16:45:41 -0700, tatto0_2000@yahoo.com (Wong) wrote:

Sound so simple to manage par port since I can have direct control
over the signals.
It is once you get to grips with the functions of each of the three registers.

So if I have the following C code:
outp(37A, 0x04); // Would this reset the printer ?
I make a practice of (Basic code, I don't speak C)

OUT 37A, (INP(37A) AND 04)

That way, whatever other bits are set/clear remain that way.


data = inp (379); // Would this assign the status port signal level
to 'data' ?
Yes.
 
John G wrote:
"R. Steve Walz" <rstevew@armory.com> wrote in message
news:40A30A36.1E91@armory.com...
John G wrote:

"Wong" <tatto0_2000@yahoo.com> wrote in message
news:509bfe22.0405121950.1a927c85@posting.google.com...
Hi,
Address of 378 is normally define for printer port,
LPT.
Then what is the purpose to use the address of 379,
37A
?
I am confuse and hope someone can shed me a light.
Thanks.

All these hardware addresses can be used by printer
adapters
and at boot time the Operating system checks to see
which
are present and allocates them to LPT1 then 2 then 3 as
they are found.
--
John G

Wot's Your Real Problem?
-------------
No, the port base addresses are 378, 278, and 3BC Hex.

The addresses 379 and 37A Hex are the other two addresses
that are part of the LPT1 port at 378 Hex.

-Steve

You are absolutly correct.
It is so long since I needed to care about this I jumped to
the wrong conclusion.
But 378H will only be LPT1 if there is something there.
If 278H is the hardware address of the only print adapter
the it will become LPT1
This may be rare but it did confuse many people long ago.
(Remember DOS)
The Monchrome and Print adapter had one address and the
Print adapter had another.
--
John G
----------------
Actually, the original LPT1 port base address on the PC was 3BC Hex,
but it is only assigned LPT1 status in DOS/Win if it is found active,
using a loopback data test, since it was only implemented on the early
mono-text-only-printer cards, and mono-graphic-printer cards and
Hercules cards and a few of the earliest higher level graphic cards.

The second LPT2 was originally the 378 Hex addrsss, and the 278 Hex
was the LPT3, but only if 3BC Hex was found and assigned to LPT1,
and without 3BC Hex being found, then 378 Hex defaults to LPT1 and
278 Hex defaults to LPT 2.

-Steve
--
-Steve Walz rstevew@armory.com ftp://ftp.armory.com/pub/user/rstevew
Electronics Site!! 1000's of Files and Dirs!! With Schematics Galore!!
http://www.armory.com/~rstevew or http://www.armory.com/~rstevew/Public
 
Wong wrote:
Sound so simple to manage par port since I can have direct control
over the signals. So if I have the following C code:
outp(37A, 0x04); // Would this reset the printer ?

data = inp (379); // Would this assign the status port signal level
to 'data' ?
---------------
No. The uses I have been discussing for the parallel port are totally
disregarding its system role as a printer port.

A reason to send 04 to that port might be to set the control outputs
to a friendly state for printer initialization because of the
inversions in that data byte.

I never recall what use the printer puts that pin to, so I never care.
Printers can pretty much take care of themselves. Re-init the driver
and turn them off and on if they act weird.

BUT!:
Note that only bit that is not inverted is C2 or the "4's" bit, so
that writing 04 Hex to it makes it active HI along with the rest.

This enables external open-collectors to pull it LO so these pins
can be used as alternate inputs and can be read back by a read from
the address 37A Hex.

That's something NO printer I know of uses. You can make the parallel
port input a whole byte by that means. 5 status + 3 control.

-Steve
--
-Steve Walz rstevew@armory.com ftp://ftp.armory.com/pub/user/rstevew
Electronics Site!! 1000's of Files and Dirs!! With Schematics Galore!!
http://www.armory.com/~rstevew or http://www.armory.com/~rstevew/Public


"R. Steve Walz" <rstevew@armory.com> wrote in message news:<40A309D5.45B8@armory.com>...
Bill Vajk wrote:

Tim Kettring wrote:
"Bill Vajk" <bill9north@hotmailDITCHTHIS.com> wrote in message
news:uvOdneqN0PWgaD_dRVn-gw@comcast.com...

Wong wrote:

Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.

I often have more than one printer and printer port
on a computer.

Wong answer LOL

Works for me.
---------------
WRONGO! 378 is the Hex address of the data byte (D0-D7) on LPT port
pins 2 thru 9. The ports 379 Hex and 37A Hex are the +1and +2 offset
ports for LPT1 that control the other pins, 379 reads the pins
10 thru 13 and 15 status bits (S7-S3) as inputs, and 37A writes to
the pins 1, 14, 16, 17, the Control bits C0 thru C3.

Now a few of these are inverted, and the control pins are open
collector, so that they can be read back from the same address.

Use this diagram to determine this:

http://www.armory.com/~rstevew/Public/LPT/parallel.gif

S7 and C3, C1, and C0 are inverted.

The other alternate LPT2 and LPT3 addresses have base (Data byte)
addresses starting at 278 Hex and 3BC hex, and each has two more
+1 and +2 offset ports as well for their Status and Control pins.

-Steve
 
"budgie" <me@privacy.net> wrote in message
news:3e78a0hh74msr1042ooftfju2e5hjc35b6@4ax.com...
On 13 May 2004 16:45:41 -0700, tatto0_2000@yahoo.com (Wong) wrote:

Sound so simple to manage par port since I can have direct control
over the signals.

It is once you get to grips with the functions of each of the three
registers.

So if I have the following C code:
outp(37A, 0x04); // Would this reset the printer ?

I make a practice of (Basic code, I don't speak C)

OUT 37A, (INP(37A) AND 04)

That way, whatever other bits are set/clear remain that way.
Actually, they don't - that code clears them all! You want this:

TEMP = INP(37A)
TEMP = TEMP AND FB
TEMP = TEMP OR (MYDATA AND 04)
OUT 37A, TEMP

It could all be written in one line, but that's too cryptic - when I
go back and look at code a year later, I like to be able to read it. ;-)

Cheers!
Rich
 
On Fri, 14 May 2004 03:22:49 GMT, "Rich Grise" <null@example.net> wrote:

"budgie" <me@privacy.net> wrote in message
news:3e78a0hh74msr1042ooftfju2e5hjc35b6@4ax.com...
On 13 May 2004 16:45:41 -0700, tatto0_2000@yahoo.com (Wong) wrote:

Sound so simple to manage par port since I can have direct control
over the signals.

It is once you get to grips with the functions of each of the three
registers.

So if I have the following C code:
outp(37A, 0x04); // Would this reset the printer ?

I make a practice of (Basic code, I don't speak C)

OUT 37A, (INP(37A) AND 04)

That way, whatever other bits are set/clear remain that way.

Actually, they don't - that code clears them all!
It doesn't actually. Try it some time.

You want this:

TEMP = INP(37A)
TEMP = TEMP AND FB
TEMP = TEMP OR (MYDATA AND 04)
OUT 37A, TEMP
No, I like mine beacuse it fits on one line without being cryptic, and it works.

It could all be written in one line, but that's too cryptic - when I
go back and look at code a year later, I like to be able to read it. ;-)
I do too. At least we agree on one thing :)
 

Welcome to EDABoard.com

Sponsor

Back
Top