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!
> 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>
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 <rsillemKILLspamFLASH.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!
>
________________________________________________________________
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/.
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
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.
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!
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 . . .
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.
>>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.
At 03:13 PM 7/29/02 -0500, Richard Mellina wrote: {Quote hidden}
>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 . . .
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.
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.
>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
___________________________________________
>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.
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.
>
>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.
>
>
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.
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
>
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...
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.
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