Searching \ for '[PIC]:18F compare routines' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=18F
Search entire site for: '18F compare routines'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:18F compare routines'
2005\12\14@134059 by antoniasse

flavicon
face
Hi all.

I need to make a 16bit number compares A<B, A>B, A<=B ,A>=B.

Have somebody got it in asm code for the 18F series
to help me?

Best Regards

Luis F.


2005\12\14@135129 by olin piclist

face picon face
antoniasse wrote:
> I need to make a 16bit number compares A<B, A>B, A<=B ,A>=B.
>
> Have somebody got it in asm code for the 18F series
> to help me?

I don't, but given that the 18F has a subtract with borrow instruction, this
should be easy to do yourself.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2005\12\14@150643 by Jan-Erik Soderholm

face picon face
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.



2005\12\15@055431 by antoniasse

flavicon
face

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.



{Quote hidden}

> -

2005\12\15@114641 by antoniasse

flavicon
face
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}

>> --

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...