Searching \ for 'test Bit' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=test+bit
Search entire site for: 'test Bit'.

Truncated match.
PICList Thread
'test Bit'
1997\03\06@043214 by n/a

flavicon
face
Hello,

i will test a bit in a variable.

ASM-Code:

DATZ2 equ 13            ( 0 < DATZ2 < 7 can I define this array ?)
DATB1 equ 14

BTFSS   DATB1,DATZ2

the compiler output a warning (least significant...) it's ok.
when I disasemble the prg then...

btfss 14,03     this is not ok !!! ???

03 this was the least significant... from 13 ?

How I can make this better ? With "OR" or other ?

Mathias

1997\03\06@071349 by Hamilton Feltman

flavicon
face
{Quote hidden}

Hmm. It seems to me, and I've only worked with 8 bit microcontrollers, that
the compiler truncated the 13 (hex) to 03 (hex). What kind of Pic are you
working with?

-Hamilton


Hamilton Feltman
hamiltonspamspam_OUTbudhi.com
Programmer and Sound Engineer
|_     _||_ .    _  _  _ _
|_)(_)(_|| )| . (_ (_)( | )
http://www.budhi.com

1997\03\06@092142 by Kieran Sullivan

flavicon
face
{Quote hidden}

BTFSS is BIT test file skip if set. This means you are trying to test bit 13 of an 8 bit register. The assembler decides you meant bit 3 for some reason.

>How I can make this better ? With "OR" or other ?
>
>Mathias
>
>

Kieran

1997\03\06@171626 by Andrew Warren

face
flavicon
face
Mathias Kuester
<mathias.kuester%RemoveMEp3.f1800.n100.z55TakeThisOuTspamkids.netzservice.de> wrote:

> i will test a bit in a variable.
>
> DATZ2 equ 13            ( 0 < DATZ2 < 7 can I define this array ?)
> DATB1 equ 14
>
> BTFSS   DATB1,DATZ2
>
> the compiler output a warning (least significant...) it's ok.
> when I disasemble the prg then...
>
> btfss 14,03     this is not ok !!! ???
>
> 03 this was the least significant... from 13 ?
>
> How I can make this better ? With "OR" or other ?

Mathias:

If you look at the PIC instruction-set documentation, you'll see that
the BTFSS instruction can't be used the way you want... The second
operand must be a LITERAL value between 0 and 7.

If I were in your situation, I'd reorganize my data structures so
that this operation was no longer required.  If you can't do that,
you might want to try one of these methods, instead:

SOLUTION #1:
------------

       INCF    DATZ2,W
       MOVWF   TEMP1

       CLRF    TEMP2
       SETC

   LOOP:

       RLF     TEMP2
       DECFSZ  TEMP1
       GOTO    LOOP

       MOVF    TEMP2,W
       ANDWF   DATB1,w
       SKPNZ

SOLUTION #2:
------------

       MOVF    DATZ2,W
       ADDWF   PCL

       ADDLW   0
       ADDLW   -1
       ADDLW   -3
       ADDLW   -7
       ADDLW   -15
       ADDLW   -31
       ADDLW   -63
       ADDLW   121

       ANDWF   DATB1,W
       SKPNZ

Note that you'll have to ensure that DATZ2 is in the range [0-7] at
the start of both of these routines, and that "Solution #2" will
have problems if the "ADDLW" table crosses page boundaries.

-Andy

=== Andrew Warren - spamBeGonefastfwdspamBeGonespamix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Did the information in this post help you?  Consider
=== contributing to the PICLIST Fund.  Details are at:
=== www.geocities.com/SiliconValley/2499/fund.html

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