devonsc
Advanced Member level 4

subtraction using pic
Hi there,
Would like to ask you guys something about the PIC program to perform subtraction. Mind to comment about it? Thanks in advance.
In the following, am I right to say that '00011111' minus '00000001'? But it is 2's complement? Mind teaching about this matter? Not very sure about it.
Does it mean that '00011111' will be converted into '11100000' and this value will added with '1' and in the end, I obtained '11100001'?
But then, I do not know how to continue from here, mind teaching? Please? Hope you dont mind me asking such direct help. Please?
-------------------------------------
MOVLW B'00000001'
SUBLW B'00011111'
BTFSS STATUS,C
BTFSC STATUS,Z
BSF PORTC,2
GOTO START
END
-------------------------------------
Hi there,
Would like to ask you guys something about the PIC program to perform subtraction. Mind to comment about it? Thanks in advance.
In the following, am I right to say that '00011111' minus '00000001'? But it is 2's complement? Mind teaching about this matter? Not very sure about it.
Does it mean that '00011111' will be converted into '11100000' and this value will added with '1' and in the end, I obtained '11100001'?
But then, I do not know how to continue from here, mind teaching? Please? Hope you dont mind me asking such direct help. Please?
-------------------------------------
MOVLW B'00000001'
SUBLW B'00011111'
BTFSS STATUS,C
BTFSC STATUS,Z
BSF PORTC,2
GOTO START
END
-------------------------------------