I tried to fix it using 18F compares instructions and I didn't like
of the result. I will continue using like a 16F series that has worked.
See below:
RAM >= X RAM <= X
movlw XL movf RAML,W
subwf RAML,W sublw XL
movlw XH movf RAMH,W
btfss STATUS,C btfss STATUS,C
addlw 1 addlw 1
subwf RAMH,W sublw XH
btfsc STATUS,C btfsc STATUS,C
bra TRUE bra TRUE
I thought that would spend less codes using the 18F instructions to make
it in a 16bit number.
Luis F.
{Quote hidden}>
> Thanks Jan-Erik
> You are right, I´ve got it using the 18F compare instructions.
> I did a mistake, because I´ve been using to 16F series.
> I also tried to do this using subtract with borrow instruction, but
> I could not make it work.
>
> Best Regards
>
> Luis F.
>
>
>
>> antoniasse wrote :
>>
>>
>>> Subject: [PIC]:18F compare routines
>>
>> Why not simply use the 18F compare *instructions* ?
>>
>> Note that in most cases it's enough to compare
>> the high bytes of the 16 bit numbers, only if they
>> are equal you have to compare the low bytes.
>> Depending on which of the operations you are
>> doing, of course.
>>
>> Jan-Erik.
>>
>>
>>
>> --