Searching \ for '[PIC]: Code commenting' 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: 'Code commenting'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Code commenting'
2002\07\29@152110 by Richard Mellina

picon face
       I wrote an include for a project I am working on and I commented it. I
tried build it but I got about a hundred 107 Errors that say "Illegal
digit". So I took all the comments out and it worked fine. Does this mean
that I can't comment include files? Thanks!

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\29@153758 by Brendan Moran

flavicon
face
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>         I wrote an include for a project I am working on and I
> commented it. I tried build it but I got about a hundred 107 Errors
> that say "Illegal digit". So I took all the comments out and it
> worked fine. Does this mean that I can't comment include files?
> Thanks!

No.  What character did you use for commenting?

- --Brendan

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>

iQA/AwUBPUWYEQVk8xtQuK+BEQLrWACeOY6L/etWU5j17kZBrbhJYi6fR5UAn3r+
AfV2157Q2PjvCkI/X07vf93r
=YN1P
-----END PGP SIGNATURE-----

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2002\07\29@154217 by Harold M Hallikainen

picon face
You can do pretty much anything in an include file that you can do in
your main asm file. Can you submit a couple lines from the include file
that the assembler complained about?

Harold

On Mon, 29 Jul 2002 14:16:27 -0500 Richard Mellina <rsillemspamKILLspamFLASH.NET>
writes:
>         I wrote an include for a project I am working on and I
> commented it. I
> tried build it but I got about a hundred 107 Errors that say
> "Illegal
> digit". So I took all the comments out and it worked fine. Does this
> mean
> that I can't comment include files? Thanks!
>


FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

Reach broadcasters, engineers, manufacturers, compliance labs, and
attorneys.
Advertise at http://www.hallikainen.com/FccRules/ .


________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/web/.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\07\29@155750 by Dwayne Reid

flavicon
face
At 02:16 PM 7/29/02 -0500, Richard Mellina wrote:
>         I wrote an include for a project I am working on and I commented
> it. I
>tried build it but I got about a hundred 107 Errors that say "Illegal
>digit". So I took all the comments out and it worked fine. Does this mean
>that I can't comment include files? Thanks!

The comment character for MPASM is ;

In other words,

;this is a comment line
  btfsc    _START          ;start button pressed?
    goto   SendStartInit   ;this is another comment

hope this helps

dwayne

--
Dwayne Reid   <EraseMEdwaynerspam_OUTspamTakeThisOuTplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2002\07\29@161745 by Richard Mellina

picon face
I used the ";" character to comment as always. This is an example of how it
was commented:


name            equ     h'20'                   ; this register is for so and so

name2           equ     4                       ; this bit is for so and so

#define name3   [something]             ; this is used by so and so


MPASM created an error for every letter that was not a hex number, even the
semicolons. When I took all the comments out it assembled with no errors.
Perhaps a setting is not right? Thanks!




{Original Message removed}

2002\07\29@163546 by Dwayne Reid

flavicon
face
At 03:13 PM 7/29/02 -0500, Richard Mellina wrote:
>I used the ";" character to comment as always. This is an example of how it
>was commented:
>
>
>name            equ     h'20'                   ; this register is for so
>and so
>
>name2           equ     4                       ; this bit is for so and so
>
>#define name3   [something]             ; this is used by so and so
>
>
>MPASM created an error for every letter that was not a hex number, even the
>semicolons. When I took all the comments out it assembled with no errors.
>Perhaps a setting is not right? Thanks!

Any chance that you have an unmatched ' somewhere?

dwayne

BTW - I tend to mix the radix definitions up - I use 0x20, .30 and
b'00001111' for hex, decimal and binary, respectively.  No real reason for
doing so . . .

dwayne

--
Dwayne Reid   <@spam@dwaynerKILLspamspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email KILLspamlistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\29@164908 by Barry Gershenfeld

face picon face
>>MPASM created an error for every letter that was not a hex number, even the
>>semicolons. When I took all the comments out it assembled with no errors.
>>Perhaps a setting is not right? Thanks!
>
>Any chance that you have an unmatched ' somewhere?
>
>dwayne

"somewhere"

Look at the first line that reported an error.  Then look back
one line.   If it's already the first line look at the
code file that #included it.

Barry

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\29@171359 by Richard Mellina

picon face
Thanks a lot! It turns out I had three unmatched '! I would have never
thought of it.

-----Original Message-----
From: pic microcontroller discussion list
[spamBeGonePICLISTspamBeGonespamMITVMA.MIT.EDU]On Behalf Of Dwayne Reid
Sent: Monday, July 29, 2002 3:31 PM
To: TakeThisOuTPICLISTEraseMEspamspam_OUTMITVMA.MIT.EDU
Subject: Re: [PIC]: Code commenting


At 03:13 PM 7/29/02 -0500, Richard Mellina wrote:
{Quote hidden}

Any chance that you have an unmatched ' somewhere?

dwayne

BTW - I tend to mix the radix definitions up - I use 0x20, .30 and
b'00001111' for hex, decimal and binary, respectively.  No real reason for
doing so . . .

dwayne

--
Dwayne Reid   <RemoveMEdwaynerspamTakeThisOuTplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservEraseMEspam.....mitvma.mit.edu with SET PICList DIGEST in the body

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\29@181656 by Bob Barr

flavicon
face
On Mon, 29 Jul 2002 15:13:13 -0500, Richard Mellina wrote:

>I used the ";" character to comment as always. This is an example of how it
>was commented:
>
>
>name            equ     h'20'                   ; this register is for so and so
>
>name2           equ     4                       ; this bit is for so and so
>
>#define name3   [something]             ; this is used by so and so
>
>

You shouldn't be using a comment on the same line as your '#define'
statement. They operate very differently from 'equ' statements.
An 'equ' substitutes the *value* that you've equated the name to; the
comment portion is ignored. (It only appears at the 'equ' line.)

A '#define' substitutes the *text* that you've specified including the
comment portion. The comment portion of your '#define' statement is
being substituted into your source file, and not stripped out.


Regards, Bob

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservEraseMEspamEraseMEmitvma.mit.edu with SET PICList DIGEST in the body


2002\07\29@183735 by David Duffy

flavicon
face
>On Mon, 29 Jul 2002 15:13:13 -0500, Richard Mellina wrote:
>
> >I used the ";" character to comment as always. This is an example of how it
> >was commented:
> >
> >
> >name            equ     h'20'                   ; this register is for
> so and so
> >
> >name2           equ     4                       ; this bit is for so and so
> >
> >#define name3   [something]             ; this is used by so and so

Bob Barr wrote:
>You shouldn't be using a comment on the same line as your '#define'
>statement. They operate very differently from 'equ' statements.

Rubbish! You can & should comment wherever you like/need.
But I do mean that in the nicest possible way!  :-)

>An 'equ' substitutes the *value* that you've equated the name to; the
>comment portion is ignored. (It only appears at the 'equ' line.)
>
>A '#define' substitutes the *text* that you've specified including the
>comment portion. The comment portion of your '#define' statement is
>being substituted into your source file, and not stripped out.

Yes, but the ; character still separates the comments out of it.
I've got hundreds of #define lines with comments after them.
Not all in the one assembler file mind you!
Regards...
___________________________________________
David Duffy        Audio Visual Devices P/L
U8, 9-11 Trade St, Cleveland 4163 Australia
Ph: +61 7 38210362   Fax: +61 7 38210281
New Web: http://www.audiovisualdevices.com.au
___________________________________________

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspam_OUTspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\29@184418 by Dwayne Reid

flavicon
face
At 03:04 PM 7/29/02 -0700, Bob Barr wrote:

>You shouldn't be using a comment on the same line as your '#define'
>statement. They operate very differently from 'equ' statements.
>
>An 'equ' substitutes the *value* that you've equated the name to; the
>comment portion is ignored. (It only appears at the 'equ' line.)
>
>A '#define' substitutes the *text* that you've specified including the
>comment portion. The comment portion of your '#define' statement is
>being substituted into your source file, and not stripped out.

Something doesn't sound right, Bob.  I add a comment to the end of pretty
much every single #define in my source code and have *never* had an issue
with that.

I'll snip an example from a recent project:

; PORT A Device Bits
    #define _RA0    RA,0        ; RA0, pressure sensor a/d input
    #define _SDAT2  RA,1        ; RA1, countdown timer serial data
    #define _H_ORB  RA,2        ; RA2, hi orbit sw  == LO
    #define _M_ORB  RA,3        ; RA3, med  "   "   == LO
    #define _L_ORB  RA,4        ; RA4, low  "   "   == LO

The above is from a finished project - no problems at all with comments on
the lines.

dwayne

--
Dwayne Reid   <RemoveMEdwaynerTakeThisOuTspamspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspamspamspamBeGonemitvma.mit.edu with SET PICList DIGEST in the body


2002\07\29@192401 by Bob Barr

flavicon
face
On Mon, 29 Jul 2002 15:04:32 -0700, Bob Barr wrote:

>On Mon, 29 Jul 2002 15:13:13 -0500, Richard Mellina wrote:
>
<snip>
>>

I then responded:

{Quote hidden}

Please ignore this post. I was thinking of another assembler when I
wrote it. I've just tested it and I now see that my response was
totally off-base.

Sorry for any confusion that I may have caused.

Regards, Bob

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\30@104706 by Bill & Pookie

picon face
David,

I don't think you should say that in every case it
is ok to comment a #define.  Maybe in 97% of the
cases it will cause no problems.

Bill

{Original Message removed}

2002\07\30@133416 by Barry Gershenfeld

face picon face
I was recently reading about a compiler bug (feature?)
that was interpreting characters in comments.  This may
only be an issue with those that allow line continuation.
And it wasn't a PIC compiler, either.

It's sometimes scary to see what the preprocessor
hands to the compiler, but I have to say that it seems to
swallow it ok, else we would have broken it long ago.

Still, I try not to put comments on #define lines.  But
I will put them on the line above, because there's no
excuse for leaving comments out.

Barry



At 07:46 AM 7/30/02 -0700, you wrote:
>David,
>
>I don't think you should say that in every case it
>is ok to comment a #define.  Maybe in 97% of the
>cases it will cause no problems.
>
>Bill
>

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


2002\07\30@175840 by David Duffy

flavicon
face
Bill wrote:
>David,
>I don't think you should say that in every case it
>is ok to comment a #define.  Maybe in 97% of the
>cases it will cause no problems.

Hi Bill,
Where do you get this 97% from? I think in the case of MPLAB
100% is fine. There really is no excuse for sloppy/no comments.
We've (the list) been down this track before. Trying to figure out
some else's (or even your own code a little down the track) can
be made much easier if you put plenty of *good* comments in.
As another poster said, other compilers may not like comments
after #define lines. Microchip's does and we should be glad. :-)
Regards...

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


2002\07\31@125014 by Bill & Pookie

picon face
Hi David,

My post was made while I was in sort of a "wise
ass" mood.  And your well thought out, respectful
and informative reply puts me to shame.

I agree with you about commenting code, fully.

But.....

I have never used the window version of the
software and it has been years since I have used
the dos version.  My concern is with other
assemblers/compliers and how they implement the
#define statement.  The #define being the strange
statement that it is.

Is it wise to get into a coding habit that may not
be compatible with other assemblers/compilers.
While I may not pay the price for my choice, nor
my sons pay the price.  The sons of my sons surely
will.

And I got the 97% out of thin air.

Bill

{Original Message removed}

2002\07\31@201833 by David Duffy

flavicon
face
Bill (where's Pookie?) wrote:
>Hi David,
>My post was made while I was in sort of a "wise
>ass" mood.  And your well thought out, respectful
>and informative reply puts me to shame.

No offence taken!

>I agree with you about commenting code, fully.
>But.....
>
>I have never used the window version of the
>software and it has been years since I have used
>the dos version.  My concern is with other
>assemblers/compilers and how they implement the
>#define statement.  The #define being the strange
>statement that it is.

I was talking in the context of Microchips products.

>Is it wise to get into a coding habit that may not
>be compatible with other assemblers/compilers.
>While I may not pay the price for my choice, nor my
>sons pay the price. The sons of my sons surely will.

In the case of Microchip assembler code, I don't think
we should worry excessively about what's compatible
in the far distant future. (But do take some care)

>And I got the 97% out of thin air.

Glad to see to it was a scientific method. <VBG>
I personally wave the proverbial dead fish around first.
Regards...
___________________________________________
David Duffy        Audio Visual Devices P/L
U8, 9-11 Trade St, Cleveland 4163 Australia
Ph: +61 7 38210362   Fax: +61 7 38210281
New Web: http://www.audiovisualdevices.com.au
___________________________________________

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


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