is a > b ? how?

Status
Not open for further replies.

Bear

New Member
Hi,

i am new to pics and programming altogether, but learning.

Can anyone tell me how to test if, for example, W>a_file. ?

I just want to test this and if true, jump out of the loop.

Thanks,

Bear
 
Code:
    SUBWF  MyFile, W     ;subtract W from the file
    BTFSS  STATUS, C     ;Test for borrow (NOT carry)
    GOTO   WBigger       ;W was bigger then file
    ;W was smaller or equal to file

This sample subtracts W from the content of MyFile. If W is bigger then MyFile then there will be an underflow of MyFile and the borrow flag will be set. On a pic borrow is opposite of carry (so carry is clear on borrow and set on no borrow).
We test for the flag and jump accordingly
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…