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



2/22/03 2:59:57 PM, David Duffy <EraseMEdavidspamspamBeGoneAUDIOVISUALDEVICES.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

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.

>The BSF saves two instructions in this case. That may be important
>in busy code running at less than blistering speeds. I've written heaps
>of code that uses BCF/BSF and has/will always work just fine but I
>also have written code that uses shadow registers when required.

This looks to me like a classic case of laziness masquerading as premature micro-optimization.
Another one, which has come up here far too often, is trying to do a table lookup without checking
to see if a 256-byte boundary has been crossed.  I have a hard time imagining how writing the extra
*two* instructions needed to do this properly can be harder than trying to keep your tables
boundary-aligned.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.
<IDQKF7YVXUD96ZTON98IGYVUTLI75.3e58892a@main>

In reply to: <5.2.0.9.2.20030223064715.00bcf4b8@audiovisualdevices.com.au>
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...