Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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:
I was editing while you posted, did you get the XOR idea?
 
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.
 
You may find this helpful
 

Attachments

  • MPASM_Quick_Ref_Card_30400g.pdf
    139.6 KB · Views: 263
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.

Latest threads

New Articles From Microcontroller Tips

Back
Top