Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4922

Comparison between signed variables in PIC18 assembly

$
0
0
Hello.
The code below compares a 16 bit and an 8 bit variable.
What is not clear to me is the part after the bz diff, where xorwf and xorlw 128 are used.
What is their function?
Any suggestion\clarification on the working principle of this algorithm would be appreciated.

Thanks in advance.
Regards

Code:
; A is a 2 byte signed variable (AH A)
; B is a 1 byte signed variable (B)
; IF A>B THEN trueif
    movlw 0
    btfsc B,7
    movlw 255
    subwf AH,W
    bz diff
    movf AH,W
    xorwf...
Comparison between signed variables in PIC18 assembly

Viewing all articles
Browse latest Browse all 4922

Trending Articles