Searching \ for 'test accumulator for zero' 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=test+accumulator
Search entire site for: 'test accumulator for zero'.

Truncated match.
PICList Thread
'test accumulator for zero'
1997\01\05@211049 by Brad Pousland

flavicon
face
What is the best way to test if the accumulator is zero?

Respectfully,
      Brad

1997\01\05@213132 by Wireless Scientific

flavicon
face
At 09:15 PM 1/5/97 -0500, Brad Pousland wrote:
>What is the best way to test if the accumulator is zero?

add zero then check zero flag, is that one way of doing that?

I actually learned that at a Microchip seminar. If that's wrong, then
I didn't learn that at a Microchip seminar.

craig

1997\01\05@213716 by John Payson

picon face
> What is the best way to test if the accumulator is zero?

If you have not just done an instruction which sets the Z flag (in which
case testing the Z flag will give you the answer) your best bet is most
likely "IORLW 0" followed by testing the Z flag.  If you have a spare
RAM location and specifically desire not to affect the Z flag, you could
use three instructions thus:

       movwf   SPARE
       incfsz  SPARE
        decfsz SPARE
        do_something

If do_something is executed, then the accumulator was not zero.  Note that
the incfsz instruction was chosen because it performs an increment without
affecting any flags.

1997\01\05@222330 by John Payson

picon face
> >What is the best way to test if the accumulator is zero?
>
> add zero then check zero flag, is that one way of doing that?

That works, but it clears the carry flag.  If you want the carry flag
cleared, that's fine, otherwise it's not so great.  Normally I would use
IORLW 0; that leaves carry alone.

1997\01\06@103248 by myke predko

flavicon
face
>> >What is the best way to test if the accumulator is zero?
>>
>> add zero then check zero flag, is that one way of doing that?
>
>That works, but it clears the carry flag.  If you want the carry flag
>cleared, that's fine, otherwise it's not so great.  Normally I would use
>IORLW 0; that leaves carry alone.

AND it has the advantage of working in both the 12 and 14 bit PICs.

myke

"There are only three kinds of economists in the world.  Those who can count
and those who can't." - Eddy George, governor of the Bank of England

1997\01\06@195739 by Eduardo J. Martinez Velez

flavicon
face
part 0 644 bytes

----------
De:             Brad Pousland[SMTP:spam_OUTbpouslanTakeThisOuTspamMOLE.UVM.EDU]
Enviado:        domingo 5 de enero de 1997 23:15
Para:           Multiple recipients of list PICLIST
Asunto:         test accumulator for zero

What is the best way to test if the accumulator is zero?

Respectfully,
      Brad


----------------------------
Thanks for all - Mil gracias
----------------------------
Eduardo Jorge Mart’nez VŽlez
a   Asesoria
&   &
 s   Sistematizacion
INET: .....ejmvKILLspamspam@spam@satlink.com
 73070.3653spamKILLspamcompuserve.com
CServe: 73070,3653
2000-Rosario-SF-Argentina
TelFax: (54)(41)254561
Tel: (54)(41)8804
----------------------------

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