>-----Original Message----- >From: CaptMasterX@CS.COM [mailto:CaptMasterX@CS.COM] >Sent: Monday, March 17, 2003 12:47 PM >To: PICLIST@MITVMA.MIT.EDU >Subject: [PIC] 16F628 ASM Language question > > >The instruction set for the 16F628 looks kinda skimpy. Is there any = way to >test wreg against a certain byte and jump if it's equal. They have >instructions to test each bit, but to test against a byte, i'd have to = write >a function to go through and test every bit before i got the answer. = is >there an easier way? > >-- I'll offer one way, though I doubt it's the "most efficient" ***WARNING.. Untested code for example only********** To compare W with a literal and GOTO if equal: XORLW Literal BTFSC STATUS,Z GOTO values_match Or similar, to compare W with another register XORWF testfile,W BTFSC STATUS,Z GOTO values_match Both of these trash the W value, replacing it with zero if equal, or a mask of the bits that are different if not zero. XOR (Exclusive OR) tests two byte values. The resulting bits are ON for different and OFF for same. i.e. which bits are different. Good Luck, Lyle -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu