Searching \ for 'How do comment out more than one line in Microchip' 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/microchip/devices.htm?key=microchip
Search entire site for: 'How do comment out more than one line in Microchip'.

Truncated match.
PICList Thread
'How do comment out more than one line in Microchip'
1998\06\02@185344 by John Bellini

flavicon
face
To comment out a line we use the ';'

How do you comment out a whole section?  In "C" we use the "/*" & "*/".
What about in Microchip Assembly?

John Bellini

1998\06\02@193225 by Andrew Warren

face
flavicon
face
John Bellini <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> To comment out a line we use the ';'
>
> How do you comment out a whole section?  In "C" we use the "/*" & "*/".
> What about in Microchip Assembly?

John:

If you're using MPASM, you can just bracket your block of code
between an "IF (0)" and an "ENDIF".

Personally, I'd probably use a named constant rather than the
literal "0" in the "IF" expression... That way, you can enable
or disable the block of code by simply changing a single line
at the top of your program.  For example:

   ENABLE_TEST     EQU     0       ;1 = Enable the "Test" code
                                   ;0 = Disable the code

   ....

       IF (ENABLE_TEST)

   TEST:   BTFSS   PORTA,0        ;Wait here until RA0 goes
           GOTO    TEST           ;high.

       ENDIF

-Andy


=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499 (personal)
=== http://www.netcom.com/~fastfwd (business)

1998\06\02@193240 by Steven Kosmerchock

flavicon
face
John,
Just use the ";" at the start of every line. Ex:
;
;
;
;
;
;
;
;
;
;
All of these lines will be commented out.


                       Best regards,
                       Steven

************************************************
Steven Kosmerchock
Engineering Technician
CELWAVE
Phoenix    Arizona    USA
email:   steve.kosmerchockspamKILLspamcelwave.com
************************************************
www.geocities.com/researchtriangle/lab/6584
************************************************

---- PICLIST(a)MITVMA.MIT.EDU's Message ----

To comment out a line we use the ';'

How do you comment out a whole section?  In "C" we use the "/*" & "*/".
What about in Microchip Assembly?

John Bellini

1998\06\02@193311 by David Reinagel

picon face
John,
       Try enclosing the block of code with

   ifdef TAKE_THIS_OUT
       ...code...

   endif

Dave Reinagel
.....daverKILLspamspam.....cisco.com


{Quote hidden}

1998\06\03@004325 by TONY NIXON 54964

flavicon
picon face
  some code
  goto overhere

  block of unwanted code

overhere
  more code

Tony




PicNPoke Multimedia 16F84 Beginners PIC Tools.

**PLUS** - PicNPlay - PicNPlan - PicNPrep - PicNPost
PicNPort - DT Type Saver - *new* PicNQuiz.
Recent addition - Hex To Source converter.

http://www.picnpoke.com
Email KILLspampicnpokeKILLspamspamcdi.com.au

1998\06\03@005302 by Mike Keitz

picon face
On Tue, 2 Jun 1998 15:20:20 -0700 John Bellini <RemoveMEJBelliniTakeThisOuTspamSTATPOWER.COM>
writes:
>To comment out a line we use the ';'
>
>How do you comment out a whole section?  In "C" we use the "/*" &
>"*/".
>What about in Microchip Assembly?

You can use "IF 0" before the section and "ENDIF" after.  This makes the
section conditional and never assembles it.  If there are IF directives
inside it may not work.

>
>John Bellini
>

_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

1998\06\03@051802 by Bill Cornutt

flavicon
face
John,

My grandfather would sit me on his knee and tell me the
story of Henry Ellis.

Henry Ellis was a boy that was caught stealing sheep when he
was 19 years old.  And he was hanged before he reached 20.
The judge said at his trial "I sure hate to see a young man
go bad."

Henry's story was that he took the first sheep out of necessaity.
The second was just too damn convienent.  After that, well,
he was a sheep thief and what they do is steal sheep.

When I see conditional assemblys mentioned, I remember the
story of Henry Ellis, and "I hate to see a young man go bad."

Conditional's add a leval of complexity to a program as
far as the programmer/maintainer is concerned.  And it makes
understanding the code just that much harder.  When you
find yourself asking the question "Can I nest conditional's?"
Well, you are fully a sheep thief.

While it is sometimes necessary to modify code for debugging
reasons, there is a pitfall.  Any changes made for debugging
must be restored before the final program is assembled.  And
sometime you may find your self looking for a problem that
is caused by code that was installed while debugging.

I try to make it a pratice to start remarks for any temporary
debugging code with $$$.  This allows a search on $$$ to
show the patches that are to be removed.

Bill C.   spamBeGonebillspamBeGonespamcornutt.com

Writting a program is like fathering a child.
You must give it love, understanding and support
for the rest of your life.


----------
{Quote hidden}

1998\06\03@062000 by hatfield

flavicon
face
John Bellini wrote:
>
> To comment out a line we use the ';'
>
> How do you comment out a whole section?  In "C" we use the "/*" & "*/".
> What about in Microchip Assembly?
>
> John Bellini

I'm pretty sure you have to do it line-by-line with the ';'...
At least, that's the way I have had to do it so far.

Fred.
RemoveMEfred.hatfieldEraseMEspamEraseMEsstar.com

1998\06\03@065759 by Andrew Warren

face
flavicon
face
Bill Cornutt <RemoveMEPICLISTspam_OUTspamKILLspamMITVMA.MIT.EDU> wrote:

> Conditional's add a leval of complexity to a program as
> far as the programmer/maintainer is concerned.  And it makes
> understanding the code just that much harder.
> ....
> While it is sometimes necessary to modify code for debugging
> reasons, there is a pitfall.  Any changes made for debugging
> must be restored before the final program is assembled.  And
> sometime you may find your self looking for a problem that
> is caused by code that was installed while debugging.

   Right, Bill... Which is why conditional-assembly is a
   GOOD thing.

   Right at the top of all my programs is a section that
   looks something like this:

       ; Conditional-assembly equates.
       ;
       ; To assemble this program without any debug code,
       ; set all these constants to 0.

       DEBUGA  EQU     0       ;1 = Fake the user ID by just
                               ;    using a default of
                               ;    "1234".
                               ;0 = Get the user ID from the
                               ;    serial port.

       DEBUGB  EQU     0       ;1 = Copy all incoming serial
                               ;    data to the display.
                               ;0 = Don't.

       DEBUGC  EQU     0       ;1 = Assemble for the
                               ;    production-board's 20
                               ;    MHz crystal.
                               ;0 = Assemble for the
                               ;    emulator's 10 MHz
                               ;    crystal.

               IF (DEBUGA | DEBUGB | DEBUGC)
               MESSAGE "ASSEMBLED WITH DEBUG CODE ENABLED"
               ENDIF

   If someone reads the block-header comment, the comments
   on each EQU line, and the message generated by the
   assembler, yet STILL manages to acidentally ship any code
   with non-zero DEBUGx constants, other careers beckon.

   If he tries to maintain or modify the code WITHOUT
   reading those comments and messages, other careers beckon
   STRONGLY.

> I try to make it a pratice to start remarks for any temporary
> debugging code with $$$.  This allows a search on $$$ to
> show the patches that are to be removed.

   Yeah, but:

   1.  You (and the guy who inherits your code) have to KNOW
       that the "$$$" lines are only there for debugging.

   2.  You have to REMEMBER to remove them before shipping.

   3.  If you aren't using an editor (like CodeWright) that
       can insert and delete COLUMNS of text, it's tedious
       to comment-out large block of code that way.

   4.  Your "$$$" strings indicate that the code is
       commented-out for debugging purposes, but they give no
       indication of exactly what you're trying to accomplish
       by commenting-out the code.

       In my experience, there's often a need to comment out
       (or add) MULTIPLE sections of debugging code during
       development; if you want to selectively enable or
       disable those sections individually, your method
       quickly becomes a monumental pain in the ass.

   Just my opinion; I could be wrong.

   -Andy


=== Andrew Warren - RemoveMEfastfwdTakeThisOuTspamspamix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499 (personal)
=== http://www.netcom.com/~fastfwd (business)

1998\06\03@100328 by Harrison Cooper

flavicon
face
               Just my comments.

               I generally just make a new copy of the code, give the
old version a rev number (mycode_0.asm), and just cut out the code I
don't want, assemble, test, debug.  If the new code works, great.  If it
didn't go back to the last good version and continue.  Also, comments at
the top for each new code revision helps too.

               We all program differently.  This is just how I do it.
Applies to C, assembly, and now my verilog

1998\06\03@110118 by Stuart Allen

flavicon
face
John Bellini wrote:
>
> To comment out a line we use the ';'
>
> How do you comment out a whole section?  In "C" we use the "/*" & "*/".
> What about in Microchip Assembly?
>
> John Bellini

How about this:

#DEFINE COM      IFDEF I_AM_NOT_DEFINED
#DEFINE ECOM     ENDIF


To use:


COM

   COMMENTED OUT CODE

ECOM


Substitute COM, ECOM and I_AM_NOT_DEFINED to taste. But I don't believe /*
and */ will work, though you may find a couple of symbols that the assembler
won't mind.

Regards,

Stuart.

1998\06\03@111921 by Harold M Hallikainen

picon face
On Tue, 2 Jun 1998 15:20:20 -0700 John Bellini <EraseMEJBellinispamspamspamBeGoneSTATPOWER.COM>
writes:
>To comment out a line we use the ';'
>
>How do you comment out a whole section?  In "C" we use the "/*" &
>"*/".
>What about in Microchip Assembly?
>
>John Bellini
>


       How about...

       IF 0

       deleted code

       ENDIF


Harold




_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

1998\06\03@155301 by Bill Cornutt

flavicon
face
Andy,

Your use of conditional assembly is a thing of beauty.  And I will
use it as a model when developing code.  (at least I will try, but
sometimes in the heat of battle, I weaken.)

I have worked on code that was written for four variations of
a machine.  Conditional assemblys were used for the different
machines.  When looking at the code, the time was used equaly
between seeing which conditionals applied for the vareant in which
I was interested, and the code itself.  It was at this point that
I developed my STRONG views on the missuse of conditional assemblys.

One problem with conditional assemblys is that unless you are
working with an assembly listing, it is not easily understood
which conditionals apply.  Unless your method of commenting is
followed.

I do not intend to critize anyone, but I do have my views on 'style'.
With this in mind, there was a reply to the origional poster which
described a method of putting the entire 'if def' statement in
a three letter cryptic.

About the '$$$' notation for debugging related code.

What you say is true as my expierences go.  But you may have missed
a point that I may not have made clear.  (You read what I wrote,
not what i thought.)  This point being that the debug code marked
with the $$$ is removed as the problems are fixed amd should never
be shipped.  The $$$ markings are to insure that I can verify that
there is no debug code left active when done.

Being a unemployed contractor, I can not afford nor do I have
a computer to run, a state of the art program editor.  I do
look foward to having a chance to improve my editing abilities.
I feel that I am using a visual reprenstation of the old keypunch
and tab card system of writting programs today.  In fact, I have
not even been able to find a type font that is 'programmer friendly'.

As I said in my reply "I hate to see a young man go bad."  And it
is for this reason that I try to convey some of the many ways
"I have gone wrong".

Bill C.   RemoveMEbillKILLspamspamcornutt.com

----------
{Quote hidden}

-------------
> === Andrew Warren - spamBeGonefastfwdSTOPspamspamEraseMEix.netcom.com
  replyed

{Quote hidden}

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