Searching \ for 'NewBee: Initializing ports.' 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/ios.htm?key=port
Search entire site for: 'NewBee: Initializing ports.'.

Truncated match.
PICList Thread
'NewBee: Initializing ports.'
1999\11\05@141536 by jcowgar

flavicon
face
First off, I have been playing with PIC's for about 3 weeks now, so I am a
novice. I have built the NOPPP programmer, downloaded all tools, had have
made many PIC projects, as well as wrote some of my own basic code for
learning purposes, but in all of my code I always get a warning from the
assembler stating:

Warning[224] D:\PIC\ASM\FLDCEN2.ASM 53 : Use of this instruction is not
recommended.

This is my code (line numbers is [])

[51]    CLRF    PORTB
[52]    MOVLW   b'11111111'
[53]    TRIS    PORTB

Obviously the TRIS command is what is being complained about, and I realize
that Microchip says that we should not utilize this command, but when I
program that section of code above how Microchip suggests, my program acts
brain dead, never responding to inputs, never changing outputs... Here's how
I wrote the code that I felt Microchip wanted me to use to avoid the usage
of the TRIS command, can anyone help me out?

       CLRF    PORTB
       BSF     STATUS, RP0
       MOVLW   b'11111111'
       MOVWF   TRISB

Is anything wrong with the above code? The code compiles correct, but like I
said, my chip is then brain dead.

Thanks for any help,

Jeremy - spam_OUTKB8LFATakeThisOuTspamqsl.net
KB8LFA - K2 #600

http://www.qsl.net/kb8lfa/



{Original Message removed}

1999\11\05@171117 by John Considine

flavicon
face
That code is incorrect.  You need to make sure you move to the correct page of
memory. You do this my setting the RP0 bit in the status register (STATUS <5>)
For example.
bsf        STATUS, RP0  ;you can do this also bsf    STATUS, 5
movlw   b'11110101'
movwf    TRISB            ;remember TRISB = 85h See your PIC include file
bcf        STATUS, RP0    ;don't forget to go back to page 0 so you can access
registers there

When you read the Microchip documentation they say to access the TRIS register
directly.  By doing the above that is what you are doing.  TRISB is just a file
location just like STATUS and PORTA.  The difference is that it resides in page
1 not page 0 like the others.  So you need to move to page one.  By setting the
STATUS, RP0 bit it moves you to page 1.

Jeremy Cowgar wrote:

{Quote hidden}

> {Original Message removed}

1999\11\05@171517 by John Considine

flavicon
face
I forgot to emphasize your error.  MAKE SURE YOU CLEAR THE RP0 BIT; BCF STATUS,
RP0.  This will move you bake to page 0 so your PORTB bits can be cleared or
set.

Jeremy Cowgar wrote:

{Quote hidden}

> {Original Message removed}

1999\11\06@064418 by paulb

flavicon
face
Jeremy Cowgar wrote:

> but in all of my code I always get a warning from the assembler
> stating:
> Warning[224] D:\PIC\ASM\FLDCEN2.ASM 53 : Use of this instruction is
> not recommended.

 This is easily and (fairly) permanently fixed.  Just edit the
PIC16C84.INC file (you *are* using a 16C84 are you not?) to include the
following as the fourth line:
       ERRORLEVEL -224

 .. and you'll *never* see that spurious warning message again (unless
perhaps you do a re-install of MPLAB and omit to preserve your updated
files.  Easy and efficient!

> [51]    CLRF    PORTB
> [52]    MOVLW   b'11111111'
> [53]    TRIS    PORTB

 Works perfectly on all PICs, *including* the new ones such as the
16F87x.

> Obviously the TRIS command is what is being complained about, and I
> realize that Microchip says that we should not utilize this command,

 That's in much the same vein as Micro$oft saying you shouldn't use
Linux!

> but when I program that section of code above how Microchip suggests,
> my program acts brain dead, never responding to inputs, never changing
> outputs...

 You forgot to CLEAR RP0 again, that's why!

>         CLRF    PORTB
>         BSF     STATUS, RP0
>         MOVLW   b'11111111'
>         MOVWF   TRISB
         BCF     STATUS, RP0

 Fixed!  But you can see your code is now significantly longer.  I
*really* suggest you use the original code by preference, set the
correction into the include file and totally ignore MChip telling you to
go chase your tail.
--
 Cheers,
       Paul B.

1999\11\06@135122 by Mike M

flavicon
face
Id have to agree with paul on that one, i basically ignore almost all the "warni
ngs" that MPLAB gives me.  stick with the original code :)

mIKe

On Sat, 6 Nov 1999 19:57:30 +1100 "Paul B. Webster VK2BZC" <.....paulbKILLspamspam.....MIDCOAST.COM.A
U> wrote:
{Quote hidden}

Send someone a cool Dynamitemail flashcard greeting!! And get rewarded.
GO AHEAD! http://cards.dynamitemail.com/index.php3?rid=fc-41

1999\11\06@165951 by PSL

flavicon
face
Hi
for mplab there is a useful command call banksel
               any location in the bank
                   |
                  \ /
banksel    porta        ;move to bank0
banksel    trisa          ;move to bank1

regards

{Original Message removed}

1999\11\06@213338 by Russell McMahon

picon face
>> Obviously the TRIS command is what is being complained about, and I
>> realize that Microchip says that we should not utilize this command,
>
>  That's in much the same vein as Micro$oft saying you shouldn't use
>Linux!


Not really - we depend utterly on Microchip for TRIS continuing to work -
THEY do it in their hardware. True, they say that it may not work in future
and one of these days legacy code may not work on a new MChip cpu, but I
suspect it's never actually going to happen. I imagine they saw its removal
as a possible way to squeeze a little more out of the silicon long ago but
that developments have bypassed the usefulness to them of such a minor
change. If so they should take the warning out of newer data sheets (if it's
actually still there :-)).

RM.

1999\11\07@170806 by paulb

flavicon
face
PSL wrote:

> for mplab there is a useful command call banksel
>                 any location in the bank
>                     |
>                    \ /
> banksel    porta        ;move to bank0
> banksel    trisa          ;move to bank1

 Useful is it?  Perchance explain how useful?

 The "Gotcha" is:  What do you do with it?  Do you call it before every
reference to a banked register?  OK, if you do that, you will be calling
it a lot and adding *lots* of quite unnecessary instructions.

 Or, do you use it only before an instruction which is in a different
bank?  Fine.  But this means of course, that you *knew* the instruction
was in a different bank, and you are now taking responsibility on this
basis for putting BANKSEL in where it is needed every time, and ONLY
where it is needed.

 Now, how useful is that?

Russell McMahon wrote:

> True, they say that it may not work in future and one of these days
> legacy code may not work on a new MChip cpu, but I suspect it's never
> actually going to happen.

 My point exactly.  Would it be in their interest to suddenly have
chips not backward source-compatible (when they always were before)?

> I imagine they saw its removal as a possible way to squeeze a little
> more out of the silicon long ago but that developments have bypassed
> the usefulness to them of such a minor change.

 My analysis exactly.  I'm absolutely sure you're right there.

> If so they should take the warning out of newer data sheets (if it's
> actually still there :-)).

 It is, and there's the trick.  My *theory* is it's someone's personal
hobby-horse, possibly someone important(!) and that silly statement is
going to stick there till the bitter end just to salve their ego.
--
 Cheers,
       Paul B.

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