Searching \ for '[PIC] Assembly language question...' 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/microchip/languages.htm?key=language
Search entire site for: 'Assembly language question...'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Assembly language question...'
2000\06\14@104620 by Sumiec Jerry

flavicon
face
 Hello all,

 Is there a way to make the bit position in a bit oriented command
variable?

e.g. (I know this doesn't work, but...)
...
loop    ...
       ...
       incf    x
       btfss   reg, x
       ...
       ...
       goto    loop
...

 Or something that has a similar effect?  I also tried using INDF, but
apparently that doesn't work...

Thanks,
Jerry

2000\06\14@105811 by Martin Hill

picon face
Or how about ANDing the variable to test with a byte where the bit
you want to test is set and checking the zero flag?

CLRF     test
BSF        test,bit_to_test
MOVF    test,w
ANDWF test_byte,w
BTFSS   STATUS,Z
GOTO    BIT_SET
GOTO    BIT_CLEAR


Martin.

{Quote hidden}

2000\06\14@110025 by Bennett, Matt

flavicon
face
It takes a lot more steps, you can rotate a 1 bit mask (0x01) x times to get
it into place, AND it with reg and then check the zero flag-  I'm not going
to write up some code on the fly here- I've been doing soo much AVR
programming, I'm afraid I'll mix the opcodes!

Matt Bennett

{Original Message removed}

2000\06\14@110844 by Sumiec Jerry

flavicon
face
Got it, thanks a lot guys...  I sometimes forget to look beyond the command
and look for alternatives to provide the same function...

{Original Message removed}

2000\06\14@113417 by Michael Rigby-Jones

flavicon
face
This is an FAQ, check the archives.  Fastest method is to use a lookup table
IIRC.

Mike

{Quote hidden}

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