PIC Language Doubt

Sep 02, 2006 2 Replies

XORWF PORTA,1 could someone please tell me why we have a 1 after porta.the comtents of W ref are exored with porta.to toggle bit 2 of porta w reg should be loaded with 00100.now bit 2 of port a is toggled.then why do we need the extra 1 at end of the instruction



It's just karma !!

Cheers ............. Rheilly P

XORWF f,d

f = "register file address" d = "destination" (of results) if 0 then the results are stored in the W register (accumulator) if 1 then the results are stored in the "file register" (PORTA in this case).

It's more readable to use "W" or "F" rather than "0" or "1".

This is a read-modify-write instruction. The sampled state of PORTA is XOR'd with the W register (whatever the voltage levels on the pins translates to), and then the result is stored back on PORTA.

See the reference manuals for the relevant family.

Best regards, Spehro Pefhany

"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required