Well, one more quick question: what does the z bit in the status register indicate? I assume it must be cleared in software... btw thanx for all the great responses... Jeff -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Jason Muhammad Sent: December 4, 1999 12:49 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: PIC Table Read and Compare Questions Can also be done with XOR, four instructions; you can also express the BEQ DESTINATION as one of the Macro Arguments. BEQ MACRO FILE1, FILE2, DESTINATION MOVF FILE1, W XORWF FILE2,W ;If FILE=W, W is b'00000000', and BTFSC STATUS, Z ;the Z bit is SET. GOTO DESTINATION ENDM ; --Not equal-- code here -- Jason ======================================== E-Mail: milsumai@execpc.com ICQ # : 12978762 ======================================== .:::. ,,, _(- -)_ / ( ) \ \_/ : \_/ |_/ \_| | | | -TRY PRAYER- > Michael Rigby-Jones wrote: > > 2. What is the best way to determine if a variable is equal to > a certain > value? It's easy if you're testing one bit, but more than one > leaves me > confused. Or rather, what is comparable to the hll instruction: > > if var = 3 then > .... > end if > > I assume that you would use bit logic (and, or) to do this, but > what is the > easiest way? > > The easiest way is to do a subtract and test for zero. > > movlw 3 > subwf var,w > btfsc status,z > goto equal > goto not_equal > > Mike Rigby-Jones