Searching \ for 'Open-drain output' 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/ios.htm?key=output
Search entire site for: 'Open-drain output'.

Truncated match.
PICList Thread
'Open-drain output'
1997\12\29@161457 by Sami Khawam

flavicon
picon face
Hello,
How can I detect, in an open-drain line,
a High signal from a device while the PIC
is outputing a Low signal?
Can a pin be read when the TRIS is set to
output?

Thanks a lot.
--
Sami Khawam
spam_OUTsKhawamTakeThisOuTspambigfoot.com
.....a9501901KILLspamspam@spam@unet.univie.ac.at
http://unet.univie.ac.at/~a9501901

1997\12\29@212156 by Marc Heuler

flavicon
face
Hi Sami (Sami Khawam), in <34A81FF3.65E5spamKILLspamunet.univie.ac.at> on Dec 29 you wrote:

> How can I detect, in an open-drain line,
> a High signal from a device while the PIC
> is outputing a Low signal?
> Can a pin be read when the TRIS is set to
> output?

I don't know why you would want to do this?

Insert a resistor serially into the line.  Choose its value with the pullup
value in mind.  Make sure the pullup is on the remote side, not the PIC
side.

When the PIC outputs low and the remote does too, you will find 0V on the
remote side.  If the remote outputs 1, you will find several hundred mVs,
depending on the shunt resistor value.


                       O
                       |
                    pullup
                       |
            _____      |
PIC --------|_____|-----*----- remote
                   ^
                   |
           measurement point

1997\12\30@185025 by lmclaren

flavicon
face
Gday Sami,
Use an open drain pin on the pic,(eg RA4 on a 16c7x) and set it to be an
output, then use it as normal, but when you read it you get the real
value of the pin not what you are outputing. Dont Forget The Pull Up
Resistor.


regards

Lee McLaren


> Hi Sami (Sami Khawam), in <.....34A81FF3.65E5KILLspamspam.....unet.univie.ac.at> on Dec 29 you
wrote:
>
> > How can I detect, in an open-drain line,
> > a High signal from a device while the PIC
> > is outputing a Low signal?
> > Can a pin be read when the TRIS is set to
> > output?

1997\12\31@163319 by Mike Keitz

picon face
On Mon, 29 Dec 1997 23:10:59 +0100 Sami Khawam
<EraseMEa9501901spam_OUTspamTakeThisOuTUNET.UNIVIE.AC.AT> writes:
>Hello,
>How can I detect, in an open-drain line,
>a High signal from a device while the PIC
>is outputing a Low signal?

This is not a conventional application.  Usually every device except one
outputs a high signal, which is essentially an open circuit.  The device
which is currently allowed to send may output a low signal, which all
devices on the line interpret as a low.  The bus acts as a wired AND
gate: the line reads high only if *all* connected devices are outputting
high.  So the PIC is to detect a Low signal from a device while the PIC
is sending a High signal.

If you really need to know if all *other* devices are outputting high
except one, a possible method is to sense current flow from the bus to
the OC pin with an external discrete transistor:

   +5V----|
     |   Rp
    Rp    *-------PIC Sense In
     |   |/c
Bus---*---| NPN
     |   |\e
     |-R1--*------PIC OC In/Out

R1 provides a path to guarantee that OC In reads low when the bus is low.
It should be about the same resistance as Rp.

If some other device is outputting a low (holding the bus at ground
potential) the transistor will never turn on.  Sense In will read high.
If no other device is outputting a low except the PIC, the transistor
turns on, and Sense In will read low.  Sense In will read high when the
PIC is outputting high in either case.  While the PIC is outputting high,
the OC In/Out pin can be read to determine the level on the bus.

This is a special technique.  Nearly all OC busses run with a protocol
that avoids the need to do this.  This circuit degrades the 'low' voltage
the PIC can send to the bus by the Vbe of the transistor, which may cause
problems.

>Can a pin be read when the TRIS is set to
>output?

Yes.  The value read is always determined by the voltage present at the
pin, regardless of whether the pin is set as input or output.

1997\12\31@180317 by Dmitry Kiryashov
flavicon
face
Hello Mike. Wish you Happy New Year ! :-)

{Quote hidden}

There are also another idea how to make open-drain with only one PIC
pin.
Let us look at diagram below:

1. PIC pin is set as input
1a. Bus=HIGH => PIC pin=HIGH too (transistor in active mode)
1b. Bus=LOW => PIC pin=LOW too (transistor in saturation)

2. PIC pin is set as output
2a. PIC pin=HIGH => Bus=free (transistor is off)
2b. PIC pin=LOW => Bus=LOW (transistor in saturation)

          Bus
           |
           |
         |/c
+5v--R1--| NPN
         |\e
           |
           R2
           |
      PIC in/out pin


R1 & R2 resistance resulting from Bus specification and
type of transistor and may vary from 5KOhm to 500KOhm .

WBR Dmitry.

1997\12\31@184225 by Mike Keitz

picon face
On Thu, 1 Jan 1998 01:31:33 +0300 Dmitry Kiryashov <zewsspamspam_OUTAHA.RU> writes:

[I wrote]
>>  While the PIC is outputting high,
>> the OC In/Out pin can be read to determine the level on the bus.

I should clarify that in order to 'output high' to an open collector bus,
the PIC pin should be set to input mode (unless it is the RA4 pin, in
which case it is OK to leave it output and set it high, since it has no
pull-up output transistor).  The pull-up resistor on the bus then raises
the bus voltage to 'high' level.  So OC In/Out is either set as output
and low (to output low) or to input (to output high or input).  It should
not be set to output and high as this would supply extra current to
devices on the bus (through R1 in this case, or directly if the sensing
circuit isn't used).


{Quote hidden}

This scheme does not solve the original poster's problem(?) of being able
to tell if some other device is trying to pull the bus low at the same
time the PIC is.  Since the PIC pin must be forced low to turn the
transistor on, it is not possible to read any meaningful value back in
this condition.

It is a useful circuit, however, to isolate the PIC from the bus while
the PIC power is removed.  The +5V to R1 would come from the same source
that powers the PIC.  When this voltage goes to 0, the transistor stays
off all the time and no current flows from the bus to the PIC.  Usually a
FET is used as it has less voltage drop when the PIC is trying to pull
the bus low.

>
>R1 & R2 resistance resulting from Bus specification and
>type of transistor and may vary from 5KOhm to 500KOhm .

I think in most cases R2=0 would be best.  The value of R1 is not
critical at all, it needs to be enough to bias the transistor on fully
while the PIC is draining its maximum current from the bus.  Using a FET,
R1 could be omitted as well.


'Open-drain output'
1998\01\01@061349 by Dmitry Kiryashov
flavicon
face
Hello Mike.

{Quote hidden}

The purpose of this circuit is to interface high voltage bus with "low"
voltage PIC with minimal additional components. In my case i drive with
this kind of scheme the 12v buses. Protocol features (detecting
collision)
usually used to detect bus status.

> It is a useful circuit, however, to isolate the PIC from the bus while
> the PIC power is removed.  The +5V to R1 would come from the same source
> that powers the PIC.  When this voltage goes to 0, the transistor stays
> off all the time and no current flows from the bus to the PIC.  Usually a
> FET is used as it has less voltage drop when the PIC is trying to pull
> the bus low.

I have few practic of FET using - what kind of FET you think i should
apply
in this circuit ? But i don't sure about FET using because in this case
the bipolar go to saturation when low apply to collector or emitter.

> >R1 & R2 resistance resulting from Bus specification and
> >type of transistor and may vary from 5KOhm to 500KOhm .
> I think in most cases R2=0 would be best.  The value of R1 is not
> critical at all, it needs to be enough to bias the transistor on fully
> while the PIC is draining its maximum current from the bus.  Using a FET,
> R1 could be omitted as well.

R2 have another aim - to prevent PIC damage when transistor is breake
out
due to any reason while bus voltage more than 6 volts.

WBR Dmitry.

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