copare gprs

Status
Not open for further replies.

wejos

Member
guys is there a way i could compare two GPRs? the "AND" command drive me crazy can't make it to work since i don't know what to do next. i'm lost.

i tried something like:

A equ 0x0C

movlw 0x61 ;t in ascii
andlw 0x74 ;a in ascii
movwf A



since W was 0x61, the value of A would be 0x60 or

01100001 ----61
01110100 ----74
01100000 ----60

if W was 0x74, the value of A would be 0x74 also or

01110100 ----74
01110100 ----74
01110100 ----74


what i want to happen is compare two GPR, if both are the same, then i can set portA, 0x00 to high.
 
Last edited:
This may be the case however you have the incorrect instruction -
try ANDLW not ADDLW. You could also XOR the two values and then check the result (should be zero).
 
Last edited:
not yet gaspode i'll google about XOR. thank you gaspode and nigel. i'll look for the instruction set of my pic AGAIN lols.
 
thank you gaspode very helpful reference

"A lie gets halfway around the world before the truth has a chance to get its pants on"

lols
 
guys again thank you it worked. gaspode ty for suggesting xor. nigel for your tut, learned a lot from you.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…