The original problem was: > > Petra: I should use any port, and any bit... my idea is to make a > > subrutine to read a bit using sofware filter... How is the routine below solving this problem? It looks useful for DEFINING a bit to output, not reading a bit in. >You need to map from a bit number to a bitmask, then use logical >instructions: > >To turn on bit "BitNum" of port "PortNum": > > movf PortNum,W > movwf FSR > > movf BitNum,W > call BitToMask > iorwf INDF,F > >To turn off bit "BitNum" of port "PortNum": > > movf PortNum,W > movwf FSR > > movf BitNum,W > call BitToMask > xorlw 0xFF > andwf INDF,F > > >BitToMask: > addwf pcl > retlw 1 > retlw 2 > retlw 4 > retlw 8 > retlw 16 > retlw 32 > retlw 64 > retlw 128 _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.