piclist 2003\02\23\041915a >
Thread: Pin won't turn off properly
www.piclist.com/techref/ubicom/devices.htm?key=sx
flavicon
face BY : David Duffy email (remove spam text)



>2/22/03 2:59:57 PM, David Duffy <davidEraseMEspamspam_OUTAUDIOVISUALDEVICES.COM.AU> wrote:
>
> >With a correctly designed circuit, the BCF/BSF instructions are a
> >valid way to code. I'd rather code it as "BSF PORTA,LED" than use
> >a shadow register and do:
> >BSF             SHADOW,LED
> >MOVF            SHADOW,F
> >MOVWF   PORTA

Eric B:
>You know, your choice of symbolic name for the bit in question really
>detracts from your argument.
>If I wanted to make the point Russell was making, I wouldn't have picked
>the direct-base-drive
>transistor example.  I'd have picked directly driving an LED.  And that's
>exactly the sort of static
>load that will give you static RMW problems.  Try that with two or more
>LEDs on a port, and you may
>well find that trying to turn one of them off or on affects the other.

Huh? What's the problem with more than one LED on the same port and BCF/BSF?
I am NOT saying doing consecutive BCF/BSF operations on a port is ok - I
never have.
What I'm saying is that BCF/BSF operations are perfectly valid although you
do have to
be careful not to end up with them too close together and causing problems.
That's no reason to "throw the baby out with the bath water" is it? Are you
suggesting
that the LED's are connected to the port pins with no current limiting
resistors?
I don't design that way - maybe others do. In my book, that's just bad
design practice.
Do designers really take such nasty shortcuts in their hardware? I surely
hope not.
Maybe that's the case with people who write code with no real hardware
experience.

{Quote hidden}

Double Huh? The table lookup case shares nothing in common with the LED
example.
If you're in an interrupt routine and want to turn the LED on/off, you'd
really don't want to be
wasting clock cycles on a shadow register when the BCF/BSF would be quite ok.
I agree with the table boundary checking. Maybe if time is scarce AND you
are doing a lot
of table lookups AND you can put the table somewhere safe, then you can
skip them.
The table has got more chance of being shifted to where it's crossing a
boundary when
the code is modified than my simple LED example going loopy sometime in the
future.
David...

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.
<5.2.0.9.2.20030223185723.00bb0c38@audiovisualdevices.com.au>

In reply to: <IDQKF7YVXUD96ZTON98IGYVUTLI75.3e58892a@main>
See also: www.piclist.com/techref/ubicom/devices.htm?key=sx
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Pin won't turn off properly

month overview.

new search...