As noted in my previous message you could use the routine from the piclist.com faq: http://www.piclist.com/techref/microchip/math/bit/mask.htm ; Convert 3-bit number (0-7) in INDEX to a 8-bit mask (00000001 ... ; 10000000) in BitP. movfw INDEX andlw b'00000011' ;Start with half of the mask. movwf BitP incf BitP, W ;The 4-bit converter btfsc BitP, 1 iorwf BitP, F incf BitP, F btfsc INDEX, 2 ;Is it high 4 bits? swapf BitP, F So you make your number into a mask, then you can apply that mask to the number from the port. Your value (set or clear) will show up in the status register, zero bit. -Adam Gonzalo Jimenez Yamasaki wrote: > > Well I4ve found FSR and INDF, but that can solve half my problem... with > this I can select porta, portb or portc easily, but what about bits, how can > I choose between them? > > Petra: I should use any port, and any bit... my idea is to make a > subrutine to read a bit using sofware filter... > > Regards, > > Gonzalo > > ----- Mensaje original ----- > De: "Olin Lathrop" > Para: > Enviado: Jueves 4 de Enero de 2001 2:31 PM > Asunto: Re: [PIC]: Not use the address but what is inside that address > > | > What I want to do exactly is to have to variables, one with the port > I > | > want to use (let4s call it "port") and another one with the bit I want > to > | > read (let4s call it "bit") then use the instruccion btfss. > | > > | > Something like this: > | > > | > porta --> port > | > 3 --> bit > | > > | > btfss port, bit > | > > | > What should mean btfss porta, 3 > | > > | > Is it possible? > | > | If "bit" and "port" are assembler variables, then yes. No matter how you > | may try to disguise it, the register and bit referenced by a BTFSS > | instruction are hard coded into the instruction, and therefore must be > known > | at assembly time. > | > | If you need to dynamically select a register at runtime, use an FSR. > There > | are more options for dynamically selecting a bit, most of which require > bit > | shifting or mask selecting. > | > | > | ***************************************************************** > | Olin Lathrop, embedded systems consultant in Devens Massachusetts > | (978) 772-3129, olin@embedinc.com, http://www.embedinc.com > | > | -- > | http://www.piclist.com hint: The PICList is archived three different > | ways. See http://www.piclist.com/#archives for details. > | > | > | > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.