Pin won't turn off properly
Eric Bohlman email (remove spam text)
2/22/03 2:59:57 PM, David Duffy <AUDIOVISUALDEVICES.COM.AU> wrote: david
>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:
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
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
In reply to: <email@example.com>
See also: www.piclist.com/techref/ubicom/devices.htm?key=sx
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the