Searching \ for '[PIC]: Mchip assembler syntax' 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/microchip/devices.htm?key=pic
Search entire site for: 'Mchip assembler syntax'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Mchip assembler syntax'
2001\01\01@195408 by David VanHorn

flavicon
face
Ok, on another subject, what's the syntax (if any) for conditional
assembly, in the more complicated cases?

The simple case is fine, like this:

 if X
stuff
 else
other stuff
 endif


However, I'd like to do something more complex, like:

 if x or y and not z
stuff
 else
 if z and y
other stuff
 else....
many other stuffs....
 endif
--
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2001\01\02@033030 by Andrew Warren

face
flavicon
face
David VanHorn <.....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU> wrote:

> what's the syntax (if any) for conditional assembly
> ....
>   if x or y and not z
> stuff
>   else
>   if z and y
> other stuff
>   else....
> many other stuffs....
>   endif

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 - fastfwdspamKILLspamix.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


2001\01\02@103538 by David VanHorn

flavicon
face
>
>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:

That was just a quick hack to get the point across.

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

Is this a separate doc? I looked in the help file, but didn't find it.

Thanks.


--
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

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


2001\01\02@132747 by Andrew Warren

flavicon
face
David VanHorn <.....PICLISTKILLspamspam.....MITVMA.MIT.EDU> wrote:

> > 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....
>
> That was just a quick hack to get the point across.

   Yeah, but it's STILL always better if you can get rid of the
   "else" directives.  Nested "ifs" are hard enough to debug; nested
   "if/elses" are nearly impossible.

> > This is all in the MPASM manual, by the way..
>
> Is this a separate doc? I looked in the help file, but didn't find it.

   Have you ever found ANYTHING useful in the MPASM help file?

   The MPASM User's Guide is a 284-page document available in PDF
   format from the Microchip web site; if you don't have it
   already, it's at:

       www.microchip.com/Download/Tools/PICmicro
            /DevEnv/MPLABi/ Software/manual/51025d.pdf

   (You'll have to cut-and-paste that into one line for your
   browser.)

   -Andy


=== Andrew Warren --- EraseMEaiwspam_OUTspamTakeThisOuTcypress.com
=== Staff Systems Engineer, IPD
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation.

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


2001\01\04@151944 by Peter L. Peres

picon face
Download the microchip assembler manual from them. The conditional can be
expressed mostly like a C expression with some range exceptions.

Peter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


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