piclist 2001\01\02\033030a >
Thread: Mchip assembler syntax
www.piclist.com/techref/microchip/devices.htm?key=pic
face
flavicon
face BY : Andrew Warren email (remove spam text)



David VanHorn <KILLspamPICLISTKILLspamspamSTOPspamMITVMA.MIT.EDU> wrote:

{Quote hidden}

Dave:

   if (x || y && !z)
       stuff
   else
   if (z && y)
       other stuff
   else
   ....
   endif
   endif

Generally speaking, it's best to put parentheses around each of your
arguments; I left them out for clarity.

Also, it's a lot easier to do this sort of thing if you can get rid
of the "elses".  In your example, for instance, "x or y and not z"
and "z and y" are mutually exclusive, so you could rewrite the code
as:

   if (x || y && !z)
       stuff
   endif
   if (z && y)
       other stuff
   endif

This is all in the MPASM manual, by the way...

-Andy


=== Andrew Warren - spamfastfwdTakeThisOuTspamix.netcom.com
=== Fast Forward Engineering - San Diego, California
=== http://www.geocities.com/SiliconValley/2499

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


<3A51213C.20844.71A53FF@localhost> 7BIT

In reply to: <4.3.2.7.2.20010101194857.021dc550@mail.cedar.net>
See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Mchip assembler syntax

month overview.

new search...