A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.
Operation btfss with a binary number in the second operand? - purp...@gmail.com - Dec 20 16:50:12 2008
I'm looking at a chunk of disassembled code for a PIC18 micro controller (PIC18LF4320, to
be exact) below
i2c_handler:
bcf PIR1, 3, ACCESS
movlw b'101101'
andwf SSPSTAT, w, ACCESS
movlb 0
movwf SSPSTAT_val, BANKED
movf SSPBUF, w, ACCESS
movwf byte_DATA_61, ACCESS
btfss SSPCON1, b'110', ACCESS
bra loc_MEM_Program_7A8
bcf SSPCON1, b'110', ACCESS
return 0
The command btfss tests a bit, and skips the next instruction if that bit is equal to 1.
In this case, the first operand is the register SSPCON1, and the second operand is binary
'110'.
My question is does that binary '110' mean that it tests the last 3 bits of SSPCON1 to see
if they are '110'? (aka testing for i2c slave mode, 7 bit address) or does that binary
'110' mean that it tests the 6th bit? (aka testing the Receive Overflow Indicator bit)
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Operation btfss with a binary number in the second operand? - Eirik Karlsen - Dec 20 18:12:34 2008
b'110' means a binary number, in this case decimal "6".... so it is
testing bit6.
p...@gmail.com skrev:
>
> I'm looking at a chunk of disassembled code for a PIC18 micro
> controller (PIC18LF4320, to be exact) below
>
> i2c_handler:
>
> bcf PIR1, 3, ACCESS
> movlw b'101101'
> andwf SSPSTAT, w, ACCESS
> movlb 0
> movwf SSPSTAT_val, BANKED
> movf SSPBUF, w, ACCESS
> movwf byte_DATA_61, ACCESS
> btfss SSPCON1, b'110', ACCESS
> bra loc_MEM_Program_7A8
> bcf SSPCON1, b'110', ACCESS
> return 0
>
> The command btfss tests a bit, and skips the next instruction if that
> bit is equal to 1. In this case, the first operand is the register
> SSPCON1, and the second operand is binary '110'.
>
> My question is does that binary '110' mean that it tests the last 3
> bits of SSPCON1 to see if they are '110'? (aka testing for i2c slave
> mode, 7 bit address) or does that binary '110' mean that it tests the
> 6th bit? (aka testing the Receive Overflow Indicator bit)
>
> __._,_._
--
*******************************************
VISIT MY HOME PAGE:
LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )Re: Operation btfss with a binary number in the second operand? - Harold Hallikainen - Dec 20 23:06:01 2008
> I'm looking at a chunk of disassembled code for a PIC18 micro controller
> (PIC18LF4320, to be exact) below
>
> i2c_handler:
>
> bcf PIR1, 3, ACCESS
> movlw b'101101'
> andwf SSPSTAT, w, ACCESS
> movlb 0
> movwf SSPSTAT_val, BANKED
> movf SSPBUF, w, ACCESS
> movwf byte_DATA_61, ACCESS
> btfss SSPCON1, b'110', ACCESS
> bra loc_MEM_Program_7A8
> bcf SSPCON1, b'110', ACCESS
> return 0
>
> The command btfss tests a bit, and skips the next instruction if that bit
> is equal to 1. In this case, the first operand is the register SSPCON1,
> and the second operand is binary '110'.
>
> My question is does that binary '110' mean that it tests the last 3 bits
> of SSPCON1 to see if they are '110'? (aka testing for i2c slave mode, 7
> bit address) or does that binary '110' mean that it tests the 6th bit?
> (aka testing the Receive Overflow Indicator bit)
>
It's your second description. btfss tests just one bit. In this case, it
skips the branch instruction if bit 6 of SSPCON1 is set.
Harold
--
FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )