piclist 2008\07\01\075924a >
Thread: Strange PIC12F675 or user problem... pin cross-connect?
face picon face BY : email (remove spam text)(Olin Lathrop)

Rolf wrote:
> I am not the only person who
> uses bcf STATUS,RP0

Lots of people don't comment their code, but that doesn't make it a good
idea either.

> and the datasheet is fairly authoritative, not?

Not when it comes to code.  Microchip examples generally suck, and sometimes
contain outright errors.  Look at the instruction set, how the machine and
the peripherals work, then write your own code.

> the clrf STATUS could
> have all sorts of intended, and unintended consequences, especially
> since it never works (clrf STATUS will always set STATUS,Z).

Then you might as well wave a dead fish over your programs in case that
makes them work better too.

> Assembler appears to be somewhat like perl, TIMTOWTDI ... ;-)


> Anyway, using hybrid/your logic, it would be better not to have a
> 'clrf STATUS', but to have banksel's before each SFR. Just in case you
> copy/paste the code.

Newbies should use BANKSEL in front of every reference that could be in a
different bank from the previous.  Once they get more comfortable with the
rest of the PIC, then they can go back and learn better ways to manage
banking.  Explictly writing BSF/BCF on RP0/RP1 is bad programming and is
never encouraged.

If you look at my interrupt template module, QQQ_INTR.ASPIC, you will see I
don't use BANKSEL, but my DBANKIF and DBANKIS macros.  I force the interrupt
temporary save registers to be in bank 0, and use CLRF STATUS as a single
instruction to select bank 0 regardless of what state STATUS was in or which
14 bit core PIC this is running on.  This is immediately followed by DBANKIS
0 and IBANKIS 0 to tell the assembler what the bank settings are.  After
that, the bank setting is tracked at assembly time and only the minimum bank
switching instructions are inserted by DBANKIF as needed.  This is of course
all explained in the comments too.

> I would rather use
> less efficient mechanisms that work for me and are clear in my head
> and
> that I understand, than use 'better' mechanisms that don't.

That's your business.  The discussion was only because you asked for help
here, and apparently did have some problems in this area.  Given that, you
might want to revist your thinking.

Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.
<00ee01c8db72$314b6b00$0300a8c0@main> 7bit

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
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) Strange PIC12F675 or user problem... pin cross-connect?

month overview.

new search...