Searching \ for ' [PIC] Port Latching' 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/microchip/ios.htm?key=port
Search entire site for: 'Port Latching'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] [PIC] Port Latching'
2002\07\07@233509 by Dave King

flavicon
face
Simple question cuz the more I look the more confused I get ;-]
I've read two conflicting comments and I don't have anything setup
to test this myself yet.

Which ports (or any) will latch to a high or low state? I need to
generate 3 continuous pwm's as well as a couple of  pulses on
another port. If they latch I can set the pin's and carry onto
other routines and then just do a housekeeping routine to see if
it changes.

If they latch then all is well. If they don't then I need to actually
think about how to do things which could hurt a bit. ;-]

Dave

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\07@235854 by Andrew Errington

flavicon
face
> Simple question cuz the more I look the more confused I get ;-]
> I've read two conflicting comments and I don't have anything setup
> to test this myself yet.
>
> Which ports (or any) will latch to a high or low state? I need to
> generate 3 continuous pwm's as well as a couple of  pulses on
> another port. If they latch I can set the pin's and carry onto
> other routines and then just do a housekeeping routine to see if
> it changes.
>
> If they latch then all is well. If they don't then I need to actually
> think about how to do things which could hurt a bit. ;-]

???

If I understand your question, then it doesn't make any sense.  All pins
are 'latching' by your definition.  Once you write a value to an output
driver it stays there, until you write another value.  Life would be
pretty hard otherwise.

Am I missing something?

Andy

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\08@002434 by Jon Baker

flavicon
face
Dave wrote
> > Which ports (or any) will latch to a high or low state?

Andy wrote
> If I understand your question, then it doesn't make any sense.  All pins
> are 'latching' by your definition.  Once you write a value to an output
> driver it stays there, until you write another value.  Life would be
> pretty hard otherwise.
>
> Am I missing something?

Perhaps Dave is getting confused with pull-ups / pull-downs? Dave?

--
Jon Baker

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\07\08@013043 by Dave King

flavicon
face
At 05:28 AM 08/07/02 +0100, you wrote:
>Dave wrote
> > > Which ports (or any) will latch to a high or low state?
>
>Andy wrote
> > If I understand your question, then it doesn't make any sense.  All pins
> > are 'latching' by your definition.  Once you write a value to an output
> > driver it stays there, until you write another value.  Life would be
> > pretty hard otherwise.
> >
> > Am I missing something?
>
>Perhaps Dave is getting confused with pull-ups / pull-downs? Dave?
>
>--
>Jon Baker

Dave is always confused at the best of times ;-]

What I was wondering about was if a port/pin would hold its state and for
how long.
The one mid mcu doc referred to a condition on port A where it could float
or drift.
I was wondering if that was the case for all of the ports or just the one.

I did work with an old moldy intel that did not hold its values which is
why I asked.
I had to continuously refresh it.

Anyway I think I have gleamed the answer from your puzzled responses ;-]

Dave

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\07\08@052109 by Russell McMahon

face
flavicon
face
> Simple question cuz the more I look the more confused I get ;-]
> I've read two conflicting comments and I don't have anything setup
> to test this myself yet.
>
> Which ports (or any) will latch to a high or low state? I need to
> generate 3 continuous pwm's as well as a couple of  pulses on
> another port. If they latch I can set the pin's and carry onto
> other routines and then just do a housekeeping routine to see if
> it changes.
>
> If they latch then all is well. If they don't then I need to actually
> think about how to do things which could hurt a bit. ;-]

For your purposes consider it true that ALL microprocessor ports, when used
as outputs as intended, ALWAYS latch. (OK - there may be some very very
specialist cases where this isn't true but take this as total truth for
now). ie when a port is configured to be an output, when you write a 1 /
high / +5v etc to it, it will stay in that state until you alter it again.
Same applies when you write a 0 / low / ground to it. It will not change by
itself UNLESS you do something else to it OR until some other function of
the processor, which SHOULD be (and may be :-) ) under your control,  alters
it

In the case of your old Intel processor the "problem" MAY have been that you
were writing to a gate or similar which decoded an address location and gave
an output at the moment of selection only. This is an entirely valid
function but is not usually intended to be used as an "output" in the normal
sense. Such a feature is usually used to control an output port or some
other peripheral.

The reference to pins "floating" refers to when they are used as INPUTS .
Essentially all PIC pins, and many pins on most processors can be configured
for use as either inputs OR outputs. (There are a special type of port pins
on some processors which can "sort of" be both at once but this is a bit
unusual and liable to be too confusing to be worth describing to you at this
stage of your pilgrimage. )(When you have achieved greater enlightenment
come back and we'll deal with quasi-input pins).  A digital input pin (one
which is meant to read either a high or low (1 or 0) will ideally be held
either high or low most of the time and cross "quickly" between the two. If
it is held somewhere in between for too long it can "cause trouble". The
periods "quickly" and "too long" are defined in the data sheet but are
usually under a microsecond unless special port pins are used (eg Schmitt
triggers - leave for now).

Analogue input pins are a special beast which are used with analogue
comparators or analogue to digital converters. They are allowed to remain at
any value between ground and supply as desired.


Hope this helps. Ask again if still unclear.



           Russell McMahon

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\07\08@094403 by Byron A Jeff

face picon face
On Sun, Jul 07, 2002 at 08:33:15PM -0700, Dave King wrote:
> Simple question cuz the more I look the more confused I get ;-]
> I've read two conflicting comments and I don't have anything setup
> to test this myself yet.
>
> Which ports (or any) will latch to a high or low state?

All general purpose PIC outputs latch to the current state of the output
driver latches. And AFAIK there are no exceptions.

BTW what are the conflicting comments that you read?

> I need to generate 3 continuous pwm's as well as a couple of  pulses on
> another port. If they latch I can set the pin's and carry onto
> other routines and then just do a housekeeping routine to see if
> it changes.

I'll amend the last phrase "to see if it NEEDS TO BE CHANGED". Given that
amendment (because normally output bits will not change on their own) then
yes it'll work as you expect. For the most part if you set an output bit
high or low, it'll remain in that state until changed again. The only thing
you need to be careful of are Read-Modify-Write instructions on a port, because
they may inadvertently flip an output bit.

>
> If they latch then all is well. If they don't then I need to actually
> think about how to do things which could hurt a bit. ;-]

The all is well. You may proceed! ;-)

BAJ

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\07\08@153345 by Dave King

flavicon
face
>All general purpose PIC outputs latch to the current state of the output
>driver latches. And AFAIK there are no exceptions.
>
>BTW what are the conflicting comments that you read?

There was a description of the ports in the mid mcu manual and it
did mention that the output could drift and or float. I should have
made the question a bit clearer initially but I had wondered if that
meant the ports/pins had to be refreshed to maintain its state. My
concern stems from the fact I'm only going to be looking at certain
pins once a second and they have to maintain the state to hold open
something else down the line.

>I'll amend the last phrase "to see if it NEEDS TO BE CHANGED". Given that
>amendment (because normally output bits will not change on their own) then
>yes it'll work as you expect.

The "IT" actually was referring to switch changes. Again my fault for not being
clear. The old intel I referred to was a old 4 bit monster that had a quirk
with
a internal capacitor needing to be refreshed other wise it would leak down
and cause the state to change. As you might guess this goes back a few
ice ages...

>For the most part if you set an output bit
>high or low, it'll remain in that state until changed again. The only thing
>you need to be careful of are Read-Modify-Write instructions on a port,
>because
>they may inadvertently flip an output bit.

Just to kill this beast stone dead ;-] Any idea of how long any/all ports will
safely stay stable or can you assume that they will as long as adequate
power is available to the system?  Hours months days etc?

>The all is well. You may proceed! ;-)

Thanks you Sir! ;-]
(Thanks Russel as well)

Cheers

Dave

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\07\08@162528 by Byron A Jeff

face picon face
On Mon, Jul 08, 2002 at 12:31:03PM -0700, Dave King wrote:
> >All general purpose PIC outputs latch to the current state of the output
> >driver latches. And AFAIK there are no exceptions.
> >
> >BTW what are the conflicting comments that you read?
>
> There was a description of the ports in the mid mcu manual and it
> did mention that the output could drift and or float.

The only reference I can find to drift or float in that document is in terms
of the Read Modify Write instructions that I talked about below. Specifically
Q/A #2 and #4 at the end of chapter 9.

> I should have
> made the question a bit clearer initially but I had wondered if that
> meant the ports/pins had to be refreshed to maintain its state.

Emphatic NO!

>My
> concern stems from the fact I'm only going to be looking at certain
> pins once a second and they have to maintain the state to hold open
> something else down the line.

No problem. Set and forget.

{Quote hidden}

Quite a few. The design specification for outputs is that it will maintain
the last state written as long as power is applied and no further instructions
modify that port.

{Quote hidden}

Forever. The code segment:

       BCF     STATUS,RP0
       BCF     STATUS,RP1
       CLRW
       TRISB
       MOVLW   0xA5
       MOVWF   PORTB
infi    GOTO    infi

will set the bits of PORTB to 0xA5 and the will never change until power is
removed.

>
> >The all is well. You may proceed! ;-)
>
> Thanks you Sir! ;-]

You are welcome.

BAJ

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\07\08@163647 by Bob Ammerman

picon face
However....
All the below being said, there are some who would feel more comfortable
periodically refreshing the output register. This would be to accomodate
disturbances due to out-of-spec (eg: noisy) power or evironment.

A lot depends on how critical it is as well as how long before the normal
processing would recover from a glitch. For example, a PWM would recover in
the very next cycle.

Bob Ammerman
RAm Systems

{Original Message removed}

2002\07\08@172928 by Russell McMahon

face
flavicon
face
> > Just to kill this beast stone dead ;-] Any idea of how long any/all
ports will
> > safely stay stable or can you assume that they will as long as adequate
> > power is available to the system?  Hours months days etc?
>
> Forever.


But, a word of warning. The above is conceptually true and is USUALLY true
in practice. However, external disturbances (electrostatic discharge, power
supply glitches etc) CAN cause processor mal-operation. Such events often
"just" destroy your processor or crash the system totally but sometimes they
can cause unexpected operation and ports can be set to unexpected states. SO
if it is easy to do so and if the output of a port is critical to system
operation you may wish to rewrite the port values periodically as part of
normal operation. You can only carry such checking so far (next you need to
verify the data that the port write is based on, then you have to ....) BUT
little things like this can help system robustness. If the 10 HP motor you
are controlling suddenly starts running after someone turns on a nearby arc
welder there may be 'trouble". Anything you can reasonably easily do to stop
it happening may be worth doing. If the flashing LED in a toy occasionally
malfunctions the consequences may not be as serious.


           Russell McMahon

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\07\08@192536 by Roman Black

flavicon
face
Dave King wrote:

> Just to kill this beast stone dead ;-] Any idea of how long any/all ports will
> safely stay stable or can you assume that they will as long as adequate
> power is available to the system?  Hours months days etc?


I believe it is good practice to refresh port outputs
when you can. Ports (and ram too) are cmos flip flops
and only stay in their existing state until something
changes them. Unfortunately that something can be psu
spikes, or spikes from the output pin itself. Which DO
happen.

It depends on how long your circuit would tolerate the
port being in the wrong state. Something like a relay
driver may tolerate wrong-state for 50mS or so, so you
only need to refresh it every 50mS. But some outputs are
more critical... Or you can set the port once and just
leave it up to fate. :o)
-Roman

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


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