Searching \ for 'programmers problem' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'programmers problem'.

Truncated match.
PICList Thread
'programmers problem'
1998\08\22@031948 by Yves.Heilig

I'm a beginner in programming of PIC, somebody can it come to my help? Here
my problem: I want to test the contents of an indexed table of the form
flag(Y), Y being a variable

The variable Y=2
How to test bit 2 of flag ?
I thought  making :

y       equ     H' 11 '
       movlw   2
       movwf   y
       btfss   flag, Y

this instruction does not give satisfaction because it uses the value
litteral of Y (H'11') and not its contents.

1998\08\22@051236 by Dmitry Kiryashov

Hello Yves.

Seems to be this topic was discussed some time ago so I'll try to
refresh it briefly. Feel free to ask any clarifying questions.

; y -> input value in range 0 .. 7 ;
; W -> output will mask like 00000001 .. 10000000

       movlw   1
       btfsc   y,1
       movlw   4
       movwf   temp

       btfsc   y,0
       addwf   temp,f

       btfsc   y,2
       swapf   temp,f

       movfw   temp

WBR Dmitry.

Yves Heilig wrote:
{Quote hidden}

1998\08\22@112818 by Yves.Heilig

thank's , i will try your code

{Quote hidden}

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