Hello everyone.
I'm using a PIC16F887 with the PICkit2.
There doesn't seem to be a compare instruction so I'm wondering how one would go about comparing the values of two registers.
For example let's say Register REG1 has a value b'00100010' and REG2 has b'000000000' but the value of REG2 increases by 1 every loop iteration. I want the loop to stop when REG2 = REG1.
Is there a way of comparing them?
It's easy in C, but how do I implement it in assembly?
I'll leave a mixture of Assembly and C for reference.
Cheers,
MOVLW b'00100010'
MOVWF REG1
CLRF REG2
Loop:
INCF REG2
;(if REG2 == REG1){
goto stop
}
else{
goto Loop
I'm using a PIC16F887 with the PICkit2.
There doesn't seem to be a compare instruction so I'm wondering how one would go about comparing the values of two registers.
For example let's say Register REG1 has a value b'00100010' and REG2 has b'000000000' but the value of REG2 increases by 1 every loop iteration. I want the loop to stop when REG2 = REG1.
Is there a way of comparing them?
It's easy in C, but how do I implement it in assembly?
I'll leave a mixture of Assembly and C for reference.
Cheers,
MOVLW b'00100010'
MOVWF REG1
CLRF REG2
Loop:
INCF REG2
;(if REG2 == REG1){
goto stop
}
else{
goto Loop