Searching \ for 'STATUS,Z:To check zero-difference?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=check+zero+difference
Search entire site for: 'STATUS,Z:To check zero-difference?'.

Truncated match.
PICList Thread
'STATUS,Z:To check zero-difference?'
1999\02\07@135709 by Skybyte

flavicon
face
Hi. Here's an EASY question:
How to check whether the difference is zero?

movlw   .67
subwf   BYTE_TO_CHECK
btfsc   STATUS,Z
<command 1>
<other command>

If BYTE_TO_CHECK is .67, the result of the thrird instruction will be zero
(67-67=0).
My questions:
* If the diff. is 0, will the Z flag of STATUS be set or cleared?
* In the above code: Will <command 1> be executed if BYTE_TO_CHECK is .67?

Thanx for your time.
Skybyte, still alive.

1999\02\07@160635 by paulb

flavicon
face
Skybyte wrote:

> movlw   .67
> subwf   BYTE_TO_CHECK
> btfsc   STATUS,Z
> <command 1>
> <other command>

> If the diff. is 0, will the Z flag of STATUS be set or cleared?

 A "Zero" flag is *set* when the accumulator is all *clear*.  Cute?

> In the above code: Will <command 1> be executed if BYTE_TO_CHECK is
> .67?

 The command is skip if *clear*, Z will be clear if comparison NOT
equal, so it it *matches* it won't skip, command 1 *will* execute.
--
 Cheers,
       Paul B.

1999\02\07@174817 by Regulus Berdin

picon face
Skybyte wrote:
> movlw   .67
> subwf   BYTE_TO_CHECK
> btfsc   STATUS,Z
> <command 1>
> <other command>
>
> If BYTE_TO_CHECK is .67, the result of the thrird instruction will be zero
> (67-67=0).
> My questions:
> * If the diff. is 0, will the Z flag of STATUS be set or cleared?
The Z flag will be SET.

> * In the above code: Will <command 1> be executed if BYTE_TO_CHECK is .67?
Yes it will not be skipped.

regards,
Reggie

1999\02\07@190509 by Jens Wilmer

flavicon
face
At 19:54 07.02.99 +0100, you wrote:
>Hi. Here's an EASY question:
>How to check whether the difference is zero?
>
>movlw   .67
>subwf   BYTE_TO_CHECK
>btfsc   STATUS,Z
><command 1>
><other command>
>
>If BYTE_TO_CHECK is .67, the result of the thrird instruction will be zero
>(67-67=0).
>My questions:
>* If the diff. is 0, will the Z flag of STATUS be set or cleared?
The Zero-Bit is set, if the result of an operation equals zero. => set
>* In the above code: Will <command 1> be executed if BYTE_TO_CHECK is .67?
btfsc means bit test file, skip if clear. => yes, <command 1> will be executed
but hereafter <other command> will also be executed.

--
ciao
 Jens Wilmer
http://www.lc.uni-muenster.de/~wilmerj/

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...