Searching \ for 'OT: Wanted: How to turn printer port data reg. to' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/mems.htm?key=data
Search entire site for: 'Wanted: How to turn printer port data reg. to'.

No exact or substring matches. trying for part
PICList Thread
'OT: Wanted: How to turn printer port data reg. to '
1998\07\24@084020 by Peter L. Peres

picon face
Hello,

 sorry to bother the list, but i have a small problem. i'm using a garden
variety multi-IO card's printer port to interface to a project
(PIC-based), and I'm now tinkering with the driver. I need to turn the
port to input but I can't. The usual way does not work (control register
bit).

 I've got no clue whether it's EPP or such. It is bidirectional, I can
read back an output value, but I do not dare to send my data against the
30 mA + short circuit current output by the port (measured).

NOTE: There are no BIOS settings to be set, and no jumpers. I'm using some
DOS or other and direct register IO in C and assembly.

 Anyone who has a clue, before I go digging into my books, please help.

thanks,

       Peter

1998\07\24@101706 by Dennis Merrill

flavicon
face
Relax, I'm sure we can get it working. First of all, who makes the IO card,
and how old is it?  This will give us a clue whether it's ECP/EPP
compatible.  If it is ECP capable, you're probably stuck in
single-directional mode, which can be set by talking to the ECP control
register. Most multi-IO cards come with some config utilities which allow
you to set the operating modes and base addresses, but I'll assume you
don't have this.

Try reading from the port: BaseAddress + 0x402h. This is the ECP control
register - if there's data in it, you need to set the highest three bits to
001 to get the ECP mode set to standard bi-directional. Then to do input
you must also set bit 5 of the control register (baseaddress + 2) to 1.
Then all should be good. LEt me know if this works and the other info so I
can help more.



-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Dennis Merrill, BSEE           work: spam_OUTmerrillTakeThisOuTspamnicolet.com
Device Driver Engineer         home: .....merrillKILLspamspam@spam@ieee.org
Embedded Systems Group
Nicolet Instrument Corp.    phone: 608.276.6136
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

1998\07\24@115856 by Peter L. Peres

picon face
On Fri, 24 Jul 1998, Dennis Merrill wrote:

> Relax, I'm sure we can get it working. First of all, who makes the IO card,
> and how old is it?  This will give us a clue whether it's ECP/EPP
> compatible.

I don't know, someone in Taiwan, 2 to 5 years ago, most likely 3. Standard
ISA multi-IO port with IDE, floppy, game, 2 serial, one parallel. I only
use the parallel (afraid of frying chipsets...). The kind sold by jameco,
and 3 dozen others for $20-25.

> If it is ECP capable, you're probably stuck in single-directional mode,
> which can be set by talking to the ECP control register. Most multi-IO
> cards come with some config utilities which allow you to set the
> operating modes and base addresses, but I'll assume you don't have this.

No such thing with this one. But, I CAN read back what I wrote when it's
in normal mode (after boot). Setting bit 5 in POSRT+2 did not work.

> Try reading from the port: BaseAddress + 0x402h. This is the ECP control
> register - if there's data in it, you need to set the highest three bits to
> 001 to get the ECP mode set to standard bi-directional. Then to do input
> you must also set bit 5 of the control register (baseaddress + 2) to 1.
> Then all should be good. LEt me know if this works and the other info so I
> can help more.

I did the +402h thing and I get to read 0x76 from the data port after
that. I've done things with ECP/EPP before but this one acts weird. Maybe
it's a 1/2 ECP, or it's really true that there are more things that I
don't know than the ones I know ;).

Here is a small C code snippet from a test main:

       outp(PORT, 0xA5); // I see this on the port, OP drive Isc ~= 30 mA
       i = inp(PORT); // i = 0xA5

       outp(PORT+0x402, 0xE0);
       outp(PORT+2, 0x10);

       i = inp(PORT); // i = 0x76h (?!), port still outputs 0xA5, vigorously
       i = inp(PORT); // same as above

Of course I've removed the interface from the connector a long time ago,
it's hot enough here. I take Isc readings from time to time, in the hope
that the thing will somehow revert to 'weak' pull-up mode (a la original
parallel port).

I seem to remember that the card has a '244 or '245 on it besides a
100-pin SQFP. Is it possible that the ASIC does EPP but someone decided to
add a booster and crippled the thing ? (I don't know if it's a 244 or
245).

I want to make sure that I don't have to add another mode to my driver, as
these things are quite common here (the no-name multi-IO cards).

Anyone know of crippled ECP/EPP capable multi-io cards ?

thanks,

       Peter

1998\07\24@142853 by Dennis Merrill

flavicon
face
At 06:48 PM 7/24/98 +0000, you wrote:
>On Fri, 24 Jul 1998, Dennis Merrill wrote:
>I don't know, someone in Taiwan, 2 to 5 years ago, most likely 3. Standard
>ISA multi-IO port with IDE, floppy, game, 2 serial, one parallel. I only
>use the parallel (afraid of frying chipsets...). The kind sold by jameco,
>and 3 dozen others for $20-25.

It's probably a FarPoint card or look alike.  These are ECP capable.
Try the following little code snippet - hook a known, static input up to
the data lines of the lpt port.

//
// Put the lpt port into BiDir mode
//
byECR = inp( PORT + 0x402 );
byECR &= 0x1F;
byECR ^= 0x20;
outp( PORT + 0x402, byECR );

//
// Set up the control lines
//
byControl = inp( PORT + 2 );
byControl ^= 0x20;
outp( PORT + 2, byControl )

//
// Now read from the data port
//
byTest = inp(PORT);

if byTest does not equal your known input, then the card is having some
problems.

>No such thing with this one. But, I CAN read back what I wrote when it's
>in normal mode (after boot). Setting bit 5 in POSRT+2 did not work.

Of course you can, they're r/w registers.

>I did the +402h thing and I get to read 0x76 from the data port after
>that. I've done things with ECP/EPP before but this one acts weird. Maybe
>it's a 1/2 ECP, or it's really true that there are more things that I
>don't know than the ones I know ;).

There is no such thing as 1/2 ECP.  You're getting ahead of yourself here.
What does the ECP register ( PORT+0x402 ) read right after you reboot your PC?

{Quote hidden}

This is not correct.  By writing E0 to the ECP register, you set your port
into configuration mode - a bad thing to do. See code above for the correct
way to do this.

>Of course I've removed the interface from the connector a long time ago,
>it's hot enough here. I take Isc readings from time to time, in the hope
>that the thing will somehow revert to 'weak' pull-up mode (a la original
>parallel port).

Listen, this is not magic.  This is a very basic thing to use - you need to
have line drivers/buffers on your hardware. If your hardware is getting
hot, there is most likely something wrong with it!

>
>I seem to remember that the card has a '244 or '245 on it besides a
>100-pin SQFP. Is it possible that the ASIC does EPP but someone decided to
>add a booster and crippled the thing ? (I don't know if it's a 244 or
>245).

If there are jumpers on it, they may be set to the wrong mode - most of
these come set to ECP mode though. Let's deal with the "knowns" first - Try
to read the ECR register.  If it contains data, it is in ECP mode!
Otherwise, we'll work from there!

>Anyone know of crippled ECP/EPP capable multi-io cards ?
I only know of crippled programmers! :)



-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Dennis Merrill, BSEE           work: merrillspamKILLspamnicolet.com
Device Driver Engineer         home: .....merrillKILLspamspam.....ieee.org
Embedded Systems Group
Nicolet Instrument Corp.    phone: 608.276.6136
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

1998\07\24@152917 by Peter L. Peres

picon face
On Fri, 24 Jul 1998, Dennis Merrill wrote:

> - snip -
> It's probably a FarPoint card or look alike.  These are ECP capable.
> - snip -

I did not look at what I picked up from the local computer shop. On
purpose. I know my thing works with a 'good' port from Intel and SiS mobo
ports, but I want to know about others.

> //
> // Put the lpt port into BiDir mode
> //
> byECR = inp( PORT + 0x402 );
> byECR &= 0x1F;
> byECR ^= 0x20;
> outp( PORT + 0x402, byECR );

 Huh ? I think you said set the top bits to 001. Maybe you meant the top
*nibble*. Small misunderstanding. Should teach me about implementing code
sent in emails w/o thinking ;)

 What I actually did, was: i = inp(PORT + 0x402); outp(PORT, i|0xE0); .
Hmm, I forgot about all those special setup modes. What you say above
means basically:

i = inp(PORT + 0x402); outp(PORT + 0x402, (i & 0x1F) | 0x20);

 I'll try this. For the moment I've reverted to the 'original' parallel
port mode, using the status lines to read nibbles, and a control signal to
select nibbles. This is built into my device, but slow.

 Did I mention about reading 0x76 after outputting 0xE0 to PORT + 402h,
permenently, even after resetting PORT + 402h to its original value (of
0xC8), until power-up reset.

> >it's a 1/2 ECP, or it's really true that there are more things that I
> >don't know than the ones I know ;).
>
> There is no such thing as 1/2 ECP.  You're getting ahead of yourself here.
> What does the ECP register ( PORT+0x402 ) read right after you reboot your PC?

I'm not getting ahead of nothing for now ;(. The register reads 0xC8.
Also, the IEEE1284 ECP/EPP reset/sense code is output on the hardware port
after boot, as it should be.

> >Here is a small C code snippet from a test main:
> >-snip-
> This is not correct.  By writing E0 to the ECP register, you set your port
> -snip-

Ok, I have to go back read what i did with this last summer. I wrote a
library to do what i needed and removed the thing from my mind. A
refresher is in order.

> >it's hot enough here. I take Isc readings from time to time, in the hope
>
> Listen, this is not magic.  This is a very basic thing to use - you need to
> have line drivers/buffers on your hardware. If your hardware is getting
> hot, there is most likely something wrong with it!

No, no. It's my vernacular English ;) The thing that is getting hot, is
the room. It's 32 degrees C here, humidity 70%, the fan is on level 3 and
I don't dare run the A/C for fear of waking the neighbors. Besides it's 10
PM on the weekend and the Med and beer and people and music are 150 meters
away to my right. I can hear the car stereos passing.

Don't worry, I'm not doing stupid things, of course I have line drivers in
my hardware, also series resistors with each signal line except ground
etc.

> If there are jumpers on it, they may be set to the wrong mode - most of
- snip -
No jumpers with resp. EPP, just address, ena/dis and IRQ.

Ok, I'll try what you are saying. Actually I might have to postpone this
for Monday (It's weekend here, I'm the last Mohican and nobody is making
me stay ;). If I email again in less than 1 hour then I won't have
postponed it. Besides the docs are @home.

> >Anyone know of crippled ECP/EPP capable multi-io cards ?
>
> I only know of crippled programmers! :)

 That is not funny. Anyway, it's better if you do not know about all the
3rd class hardware sold here as 2nd class hardware ;)

 There ARE such things as crippled parallel ports. i have one here, and I
know for sure that it is so. It's a part of an ancient (ca. 1992) CGA card
that was made for special purposes (ex medical equipment) and used to
drive a thermal 40-char miniature printer. Apparently the card was made to
order for the equipment supplier (it has some weird symbols in the
character ROM too).

 It has caused me a lot of grief with Linux lpd/apsfilter until I
understood that it was born that way and left it alone. In the process I
changed the following (for testing): jumpers, slot, main board, power
supply, printer cables, printer, printer driver program, and OS. I'm
giving up hard, see ;)

 Needless to say, there are no exterior markings on the card so you can't
tell what it is/was, except it is plain old CGA. Works ok as CGA, used to
drive a 5 in TTL color monitor cased in the unit. Sticker labels must be
damn expensive for medical equipment worth over $10.000 new... or maybe it
was a secret <g>.

thank you very much for your consistent help so far,

       Peter

1998\07\24@194729 by Peter L. Peres

picon face
On Fri, 24 Jul 1998, Dennis Merrill wrote:

> Listen, this is not magic.  This is a very basic thing to use - you need to

It was simple, once I used the correct incantation. Thanks. Funny how it
all went out of my head, I don't even use an address/phone book usually.
Hmm.

I will try this on the funny port on the CGA card. It has not occured to
me that the 'weirdness' might be a factory preset ECP/EPP mode. The card
was too old for me to think about this. When did the ECP/EPP business
start ?

thanks again for the help,

       Peter

1998\07\25@173649 by Alex Torres

picon face
>Hello,
>
>  sorry to bother the list, but i have a small problem. i'm using a garden
>variety multi-IO card's printer port to interface to a project
>(PIC-based), and I'm now tinkering with the driver. I need to turn the
>port to input but I can't. The usual way does not work (control register
>bit).
>
>  I've got no clue whether it's EPP or such. It is bidirectional, I can
>read back an output value, but I do not dare to send my data against the
>30 mA + short circuit current output by the port (measured).

Its easy to switch sirection, if the port is bidirectional:


Switch LPT1 to Input:
   mov dx, 037Ah
   in al, dx
   or al, 020h
   out dx, al

Swith LPT1 to Output:

   mov dx, 037Ah
   in al, dx
   and al, 0DFh
   out dx, al

This is what you want ?

==================================
Alex Torres, Kharkov, Ukraine (exUSSR)
E-Mail: EraseMEaltorspam_OUTspamTakeThisOuTgeocities.com
2:461/28 FidoNet
Home Page: www.geocities.com/SiliconValley/Lab/6311
ICQ UIN  11083325

1998\07\25@183956 by Alan King

picon face
Do try the other unused bit/s in that register.  Bit 5 is
normal, but there is no 'standard' and some cards have used
others.  Also check the chipset.  There may be a
bi-direction enable and they just didn't put a jumper on the
card for it.


> Anyone know of crippled ECP/EPP capable multi-io cards ?
>
> thanks,
>
>         Peter

1998\07\27@133659 by Tom Handley

picon face
  Peter, do you have any docs on that I/O card? I've been doing
bidirectional parallel I/O for a few years and never had any problems.
If the card is configured for EPP, change it back to a basic parallel
port. You already know about the control register Bit.

  - Tom

At 03:04 PM 7/24/98 +0000, Peter wrote:
{Quote hidden}

1998\07\27@134636 by Clewer,Brian

flavicon
face
Hi all,

I have been around this loop before myself.  If you need to know what
type of port your card is set to in HARDWARE, I have a program you can
run to find this out.  Watch out though, because there is probably some
jumper you can change to alter the appearance of the port.  If anybody
wants this program, please drop me a mail (brian.clewerspamspam_OUTtelematics.com).
The program also turns all the available pins to inputs and if you
ground the port pins you can see them go to a zero on the screen.

The next thing you need to do is set the type of port to a bi-directional
port.  Here is how I have done this:

       control = (0x20);                        /*This sets the TYPE of
port*/
       outport ( 0x378 + 0x402, control );     /*to a BI-directional
port*/

where control is just an integer and 0x378 is the port address.

Next is the data direction:

       control = (0x24);                       /*this sets the data
direction to input */
       outport (0x378 + 2,control);             /*      ''      ''
    '' */

You should now be able to read the port by using the inport command.


A code example of this (and more) is on my web site
http://www3.mistral.co.uk/brian.clewer/


Regards,
Brian.

1998\07\28@114317 by Peter L. Peres

picon face
> Re: All suggestions and questions

The card is an unmarked Taiwanese multi-IO card, bought for the equivalent
of $27 or so. It is not new, and there must be a few hundred thousand of
them used in this city.

My hardware needs the 'old' PS2 8-bit input mode, that is obtained by
setting the 0x10 bit in the control register. The card does not support
this, although I could confirm it to do EPP/ECP (one of these, I did not
investigate further).

My hardware uses a '257 multiplexer to make nibble-mode usable (original
p. port), but it can revert to 8 bit reads if possible. In this case, it
turns out that the 220 ohm resistors I put on every design, on every
line on the printer port, except GND, saved the day, as the port refused
to turn.

So i gave up and I couldn't care less what that card is going to feel like
in my junk pile ;) But, I have an important conclusion: If you would like
your customers to include the circle of those on a low budget, then use
'old' compatibility mode and nibbles to read data, as it seems to be the
only sure thing in the world ;) That is, if you don't use ECP/EPP only.

regards,

       Peter

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...