Searching \ for 'The Zero Status bit' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=zero+status+bit
Search entire site for: 'The Zero Status bit'.

Truncated match.
PICList Thread
'The Zero Status bit'
1997\03\18@222137 by Peter J (GEA, 068974)

flavicon
face
Say folks,

In the past to test a register for the existence of zero I would perform
some sort of mask operation.  This time I thought I would try my hand at
using the ZERO STATUS BIT.

hasn't worked yet.

Apparently I've got to first SET the zero bit PRIOR to performing a move
operation?  What I noticed is that ANY operation, zero or not, with
instructions like MOVF, or DECF will CLEAR the zero bit!

Any advice on how to check a register for zero?  It seems like such a
silly question, but I haven't been successful at it yet.

Many thanks...
Pete
spam_OUTpeter.cesarzTakeThisOuTspamappl.ge.com

1997\03\18@231529 by Clyde Smith-Stubbs

flavicon
face
Thus spake Cesarz, Peter J (GEA, 068974) (.....PETER.CESARZKILLspamspam@spam@APPL.GE.COM):

> Apparently I've got to first SET the zero bit PRIOR to performing a move
> operation?  What I noticed is that ANY operation, zero or not, with
> instructions like MOVF, or DECF will CLEAR the zero bit!

Not true. There must be something else you're doing that is making
this seem to happen. What about posting a code fragment for the
vultures to pick over?

> Any advice on how to check a register for zero?  It seems like such a
> silly question, but I haven't been successful at it yet.

Just do something like this:

       if(x == 0)

oops, you probably wanted assembler code! Try this then:

       movf    _x,f
       btfss   3,2
       goto    elsewhere
;       get here if x is zero

--
Clyde Smith-Stubbs    | HI-TECH Software,       | Voice: +61 7 3354 2411
clydespamKILLspamhtsoft.com      | P.O. Box 103, Alderley, | Fax:   +61 7 3354 2422
http://www.htsoft.com | QLD, 4051, AUSTRALIA.   |
---------------------------------------------------------------------------
Download a FREE beta version of our new ANSI C compiler for the PIC
microcontroller! Point your WWW browser at http://www.htsoft.com/

1997\03\18@232650 by Andrew Warren

face
flavicon
face
Cesarz, Peter J (GEA, 068974) <.....PICLISTKILLspamspam.....MITVMA.MIT.EDU> wrote:

> Apparently I've got to first SET the zero bit PRIOR to performing a
> move operation?  What I noticed is that ANY operation, zero or not,
> with instructions like MOVF, or DECF will CLEAR the zero bit!

   No, Peter... The Zero bit is working fine.  What you're seeing
   is that if the result of any of those instructions is NOT zero,
   the zero bit is, naturally, cleared.

   Try either of these:

       CLRF    REG
       MOVF    REG

       MOVLW   1
       MOVWF   REG
       DECF    REG

   The Zero bit will be set in both cases.

> Any advice on how to check a register for zero?  It seems like such
> a silly question, but I haven't been successful at it yet.

   Try this:

       TSTF    REG     ;Equivalent to "MOVF REG,F".
       SKPNZ           ;Equivalent to "BTFSC 3,2".
       GOTO    ITSZERO

   -Andy

=== Andrew Warren - EraseMEfastfwdspam_OUTspamTakeThisOuTix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Custodian of the PICLIST Fund -- For more info, see:
=== www.geocities.com/SiliconValley/2499/fund.html

1997\03\19@030914 by Antti Lukats

flavicon
face
At 10:13 PM 18/3/97 -0500, you wrote:
>Say folks,
>
>In the past to test a register for the existence of zero I would perform
>some sort of mask operation.  This time I thought I would try my hand at
>using the ZERO STATUS BIT.
>
>hasn't worked yet.
>
>Apparently I've got to first SET the zero bit PRIOR to performing a move
>operation?  What I noticed is that ANY operation, zero or not, with
>instructions like MOVF, or DECF will CLEAR the zero bit!
>
>Any advice on how to check a register for zero?  It seems like such a
>silly question, but I haven't been successful at it yet.

use:
movf register,f

to test register for Zero

antti




-- Silicon Studio Ltd.
-- http://www.sistudio.com

1997\03\19@040356 by mike

flavicon
picon face
In message
<c=US%a=_%p=GE%l=AP3EXPR1-970319031320Z-17686spamspam_OUTap3exh02applge.appl.ge.com>> @spam@PICLISTKILLspamspamMITVMA.MIT.EDU writes:
> Say folks,
>
> In the past to test a register for the existence of zero I would perform
> some sort of mask operation.  This time I thought I would try my hand at
> using the ZERO STATUS BIT.
>
> hasn't worked yet.
>
> Apparently I've got to first SET the zero bit PRIOR to performing a move
> operation?  What I noticed is that ANY operation, zero or not, with
> instructions like MOVF, or DECF will CLEAR the zero bit!
>
> Any advice on how to check a register for zero?  It seems like such a
> silly question, but I haven't been successful at it yet.
>
Pete,

I use the macros built in to MPASM:

 tstf  my_reg
 skpz

or

 tstf  my_reg
 skpnz

I hope this helps,


Mike Watson

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