Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/13/07 15:16
Read: times


 
#139175 - compare two 16 bit values
hello guys,

I have searched for an easier (more efficient) way to do this but I haven't come up with anything.

I am trying to compare two 16 bit values for a circular buffer routine (temp1 = write pointer, temp2 = read pointer). If they are NOT the same, proceed with routine. If they are the same, exit routine.

 
checklo:
	mov a,temp1lo
	mov b,temp2lo
	cjne a,b,proceed 	;compare LOW bytes

;temp1lo = temp1hi, so check high bytes

checkhi:
	mov a,temp1hi
	mov b,temp2hi
	cjne a,b,proceed 	;compare HIGH bytes
	sjmp exit 		;

Proceed:
	;reset temp1 values to default here, then exit


I am using at89c51ED2. I thought of using dual dptr, then switching between dptr's, but it would be a great deal of trouble copying the high & low bytes back and forth to each dptr. (seems too much of a PAIN for 4 bytes back and forth)
Anyhow, the dptr is being used, and would be too much trouble.
I would also like to keep the code compatible with older 51 devices that do not use the dual dptr's, which I have and would like to use.

anyone with any ideas?

List of 9 messages in thread
TopicAuthorDate
compare two 16 bit values            01/01/70 00:00      
   redundant move            01/01/70 00:00      
      makes sense            01/01/70 00:00      
      How about...            01/01/70 00:00      
         don\'t work !            01/01/70 00:00      
            Oops.            01/01/70 00:00      
            mov?            01/01/70 00:00      
               I don't think so...            01/01/70 00:00      
                  yes, I've fallen in that trap:)            01/01/70 00:00      

Back to Subject List