Searching \ for '[PIC]: MPLAB doesn't always ignore ' 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/languages.htm?key=mplab
Search entire site for: 'MPLAB doesn't always ignore'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] MPLAB doesn't always ignore #if0...#endi'
2001\05\21@094107 by David Cary

flavicon
face
Dear MPLAB users,

MPLAB530 gave me another incomprehensible error message today.

After narrowing it down to this test case, I discovered that MPLAB doesn't
always ignore lines
bracketed between ``#if 0'' and ``#endif''.

Is there a better place to submit MLAB bug reports ?

<quote>
Building EXCEL.HEX...

Compiling MAIN.ASM:
Command line: "C:\PROGRA~1\MPLAB530\MPASMWIN.EXE /e+ /l+ /x- /c+ /p16F877 /o+ /q
C:\DAVID\GRAPHI~1\MPLAB_~1\MAIN.ASM"
Error[125]   C:\DAVID\GRAPHI~1\MPLAB_~1\MAIN.ASM 15 : Illegal condition (ENDIF)
Error[145]   C:\DAVID\GRAPHI~1\MPLAB_~1\MAIN.ASM 17 : Unmatched ENDM

MPLAB is unable to find output file "MAIN.O".

Build failed.
</quote>

; main.asm
; MPLAB endif bug

; let: let Y = String[i];
;let macro Y String i
inc16 macro X
    nop
#if 0
old_inc16 macro X
    BANKSEL X
    incf X
    skpnz
    incf X+1
    endm
#endif

    endm

beginning CODE

begin_initialization:
    EXTERN zero_all_ram
    call zero_all_ram
mainloop:
    nop
    goto mainloop
    END
; end main.asm

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


'[PIC]: MPLAB doesn't always ignore #if0...#endif'
2001\05\21@102049 by David Cary

flavicon
face
Dear MPLAB users,

MPLAB530 gave me another incomprehensible error message today.

After narrowing it down to this test case, I discovered that MPLAB doesn't
always ignore lines
bracketed between ``#if 0'' and ``#endif''. (If I cut out those lines, MPLAB
assembles without error).

Is there a better place to submit MLAB bug reports ?

<quote>
Building EXCEL.HEX...

Compiling MAIN.ASM:
Command line: "C:\PROGRA~1\MPLAB530\MPASMWIN.EXE /e+ /l+ /x- /c+ /p16F877 /o+ /q
C:\DAVID\GRAPHI~1\MPLAB_~1\MAIN.ASM"
Error[125]   C:\DAVID\GRAPHI~1\MPLAB_~1\MAIN.ASM 15 : Illegal condition (ENDIF)
Error[145]   C:\DAVID\GRAPHI~1\MPLAB_~1\MAIN.ASM 17 : Unmatched ENDM

MPLAB is unable to find output file "MAIN.O".

Build failed.
</quote>

; main.asm
; MPLAB endif bug

; let: let Y = String[i];
;let macro Y String i
inc16 macro X
    nop
#if 0
old_inc16 macro X
    BANKSEL X
    incf X
    skpnz
    incf X+1
    endm
#endif

    endm

beginning CODE

begin_initialization:
    EXTERN zero_all_ram
    call zero_all_ram
mainloop:
    nop
    goto mainloop
    END
; end main.asm

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu


2001\05\21@112610 by Douglas Wood

picon face
That's because MPASM doesn't se the "#" character in front of the 'if' or
'endif' directives. Try running your code without the pound signs... it
should work better...

Douglas Wood
Software Engineer
dbwoodspamKILLspamkc.rr.com

Home of the EPICIS Development System for the PIC and SX
http://epicis.piclist.com

{Original Message removed}

2001\05\21@130739 by Drew Vassallo

picon face
>MPLAB530 gave me another incomprehensible error message today.
>
>After narrowing it down to this test case, I discovered that MPLAB doesn't
>always ignore lines
>bracketed between ``#if 0'' and ``#endif''. (If I cut out those lines,
>MPLAB
>assembles without error).
>
>Is there a better place to submit MLAB bug reports ?

Better than what?  The PICLIST??? Try Microchip's bug report avenue.  But I
seriously doubt you've found a bug.

I've never seen "#if"... I've only used "IF" in the first column as a
directive.  Is "#IF" even a legitimate directive?

--Andrew
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

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


2001\05\22@091714 by Olin Lathrop

face picon face
> After narrowing it down to this test case, I discovered that MPLAB doesn't
> always ignore lines
> bracketed between ``#if 0'' and ``#endif''. (If I cut out those lines,
MPLAB
> assembles without error).

The MPASM conditional assembly directives don't start with "#".


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, EraseMEolinspam_OUTspamTakeThisOuTembedinc.com, http://www.embedinc.com

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


2001\05\22@092527 by Bob Ammerman

picon face
> The MPASM conditional assembly directives don't start with "#".
>
> ********************************************************************
> Olin Lathrop, embedded systems consultant in Littleton Massachusetts
> (978) 742-9014, olinspamspam_OUTembedinc.com, http://www.embedinc.com

That is certainly true as far as the documentation goes, but they do seem to
work that way, at least if they are not in a macro.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

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


2001\05\22@124451 by David Cary

flavicon
face
Dear MPLAB users,

I think I've discovered a bug in MPASM. I expected MPLAB to ignore lines between
``if 0'' and ``endif'' lines, exactly the same as if they had been individually
commented out with ``;''.

It's not a major flaw -- when I know what's going on, I can work around it by
manually commenting out stuff with ``;''. But the error message doesn't help me
understand what's going on.

Drew Vassallo <@spam@snurpleKILLspamspamHOTMAIL.COM> on 2001-05-21 12:07:39 PM and others
mentioned:
> I've never seen "#if"... I've only used "IF" in the first column as a
> directive.  Is "#IF" even a legitimate directive?

When deleted the ``#'' characters, that just made things worse -- I got an
additional
``Warning[205] C:\DAVID\GRAPHI~1\MPLAB_~1\MAIN.ASM 15 : Found directive in
column 1. (endif)''.
Then I pushed  the
   endif
to the right with spaces which eliminated that one warning. I've attached that
code attached to the end of this message; it still gives me unexpected errors:

---- Build Results
Building EXCEL.HEX...

Compiling MAIN.ASM:
Command line: "C:\PROGRA~1\MPLAB530\MPASMWIN.EXE /e+ /l+ /x- /c+ /p16F877 /o+ /q
C:\DAVID\GRAPHI~1\MPLAB_~1\MAIN.ASM"
Error[125]   C:\DAVID\GRAPHI~1\MPLAB_~1\MAIN.ASM 15 : Illegal condition (ENDIF)
Error[145]   C:\DAVID\GRAPHI~1\MPLAB_~1\MAIN.ASM 17 : Unmatched ENDM

MPLAB is unable to find output file "MAIN.O".

Build failed.
---- end Build Results

(It doesn't matter whether that ``if'' line is in the leftmost column or not).

When I added a ``;'' to comment out each line between the if...endif (leaving
the ``if line''  and the ``endif line'' unchanged), then MPASM compiles this
code without any errors, as expected.

--
David Cary


; main.asm
; MPLAB endif bug

; let: let Y = String[i];
;let macro Y String i
inc16 macro X
    nop
if 0
old_inc16 macro X
    BANKSEL X
    incf X
    skpnz
    incf X+1
    endm
   endif

    endm

beginning CODE

begin_initialization:
    EXTERN zero_all_ram
    call zero_all_ram
mainloop:
    nop
    goto mainloop
    END
; end main.asm
; http://piclist.org/

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


2001\05\22@130244 by Douglas Wood

picon face
The ONLY thing that should in column 1 are labels. Directives and opcodes
caanot be in column as they'll be interpreted as labels...

Douglas Wood
Software Engineer
KILLspamdbwoodKILLspamspamkc.rr.com

Home of the EPICIS Development System for the PIC and SX
http://epicis.piclist.com

{Original Message removed}

2001\05\22@132155 by Bob Barr

picon face
The 'illegal condition' error generated by the 'endif' directive seems to
indicate that the 'if .. endif' pair can't be used *within a macro*.

Having the 'if' in column 1 should have generated a warning if it were being
properly recognized as a directive. I'd bet that there's a label 'if' being
generated instead.

This 'feature' (aka 'bug') probably has to do with the way that macros are
stored for future expansion rather than being assembled when they are
defined. You're right, though, the error reporting could be much better in
this case.


{Quote hidden}

<snip>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

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


2001\05\22@133708 by Drew Vassallo

picon face
>The ONLY thing that should in column 1 are labels. Directives and opcodes
>caanot be in column as they'll be interpreted as labels...

I've used IF, ELSE, and ENDIF in column 1, along with CBLOCK and others with
no problem.  It does give me a warning, but that's all.  Works just fine.
Maybe this is because MPASM accomodates this "incorrect" placement, but if
it's not broke...

I think the real question in his initial problem was the use of the "#"...
I've never seen that included in a valid directive for ASM.

--Andrew
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

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


2001\05\22@141654 by Bob Barr

picon face
>From: Drew Vassallo <RemoveMEsnurplespamTakeThisOuTHOTMAIL.COM>
>Reply-To: pic microcontroller discussion list <PICLISTEraseMEspam.....MITVMA.MIT.EDU>
>To: EraseMEPICLISTspamMITVMA.MIT.EDU
>Subject: Re: [PIC]: MPLAB doesn't always ignore #if0...#endif
>Date: Tue, 22 May 2001 13:37:08 -0400
>
>>The ONLY thing that should in column 1 are labels. Directives and opcodes
>>caanot be in column as they'll be interpreted as labels...
>
>I've used IF, ELSE, and ENDIF in column 1, along with CBLOCK and others
>with
>no problem.  It does give me a warning, but that's all.  Works just fine.

<soapbox>
Ignoring warnings may not be the best way to go. I agree that, in small
programs, warnings are no 'problem' at all. You know that a few are there
and you just ignore them. The thing is, if the number of warnings increases
as program size increases, it gets harder to see any new warnings in the
midst of the ones that have always been there.

A 'default destination' warning (where you really meant to put the result in
W) can be a bear to find in the midst of a few dozen harmless warnings. It
would stick out like a sore thumb if it were the only warning generated.

>Maybe this is because MPASM accomodates this "incorrect" placement, but if
>it's not broke...

But it is a little bit broke; it's just not broke badly enough to keep the
assembly from finishing.

</soapbox>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

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


2001\05\22@141904 by Douglas Wood

picon face
part 1 2286 bytes content-type:text/plain; (decoded 7bit)

See attached files. They show that the "if 0/endif" works in mainline code
and from inside macros...

Douglas Wood
Software Engineer
RemoveMEdbwoodEraseMEspamEraseMEkc.rr.com

Home of the EPICIS Development System for the PIC and SX
http://epicis.piclist.com

{Original Message removed}
part 2 483 bytes content-type:application/octet-stream; (decode)

part 3 2600 bytes content-type:application/octet-stream; (decode)

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


2001\05\22@144211 by Bob Ammerman
picon face
I have used IF/ENDIF in a macro without trouble.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2001\05\22@145220 by Douglas Wood

picon face
part 1 425 bytes content-type:text/plain; (decoded 7bit)

I've attached a more complete listing showing all combinations (I think) of
if / #if / endif / #endif there is.

The only thing that didn't work was having IF and/or ENDIF in column 1. The
'#' character seems to allow #IF and/or #ENDIF to be in column 1.

Douglas Wood
Software Engineer
RemoveMEdbwoodspam_OUTspamKILLspamkc.rr.com

Home of the EPICIS Development System for the PIC and SX
http://epicis.piclist.com



part 2 4802 bytes content-type:application/octet-stream; (decode)

part 3 1247 bytes content-type:application/octet-stream; (decode)

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


2001\05\22@151601 by Bob Barr

picon face
You're absolutely right (as is Douglas Wood in another response). I should
have checked further. An if..endif construct does work within a macro.

It's actually the 'endm' within the if..endif that is causing the problem.
It's not being ignored, it's terminating the macro prematurely. Upon
encountering the 'endm', the assembler stops storing the macro and starts
assembling 'normal' code.

Since the 'if' was stored as part of the macro, the assembler then sees what
it thinks is an unmatched 'endif' and reports that as an error. (It later
sees the unmatched 'endm' which results in that error as well.)

Sorry for any confusion that my original post caused.


{Quote hidden}

<snip>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

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


2001\05\22@180615 by Olin Lathrop

face picon face
> ; main.asm
> ; MPLAB endif bug
>
> ; let: let Y = String[i];
> ;let macro Y String i
> inc16 macro X
>      nop
> if 0

This should be indented.  The assembler thinks IF is a label, not an IF
directive when it's in column 1.  That's why it barfs on the ENDIF.

> old_inc16 macro X
>      BANKSEL X
>      incf X
>      skpnz
>      incf X+1
>      endm
>     endif


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinSTOPspamspamspam_OUTembedinc.com, http://www.embedinc.com

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


2001\05\23@113553 by David Cary

flavicon
face
Dear MPLAB users,

Olin Lathrop <spamBeGoneolin_piclistSTOPspamspamEraseMEEMBEDINC.COM> on 2001-05-22 03:25:21 PM claimed
>> if 0
>
>This should be indented.  The assembler thinks IF is a label, not an IF
>directive when it's in column 1.  That's why it barfs on the ENDIF.

Bzzt, wrong. I tested both ways -- in the first column, vs. indenting the "if 0"
to the right with spaces. MPLAB gave exactly the same 2 errors on my test file
either way.

I'm pretty sure Bob Barr has the correct explaination:

Bob Barr <KILLspambob_barrspamBeGonespamHOTMAIL.COM> on 2001-05-22 02:16:01 PM explained:
{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\05\23@132124 by Olin Lathrop

face picon face
> >> if 0
> >
> >This should be indented.  The assembler thinks IF is a label, not an IF
> >directive when it's in column 1.  That's why it barfs on the ENDIF.
>
> Bzzt, wrong. I tested both ways -- in the first column, vs. indenting the
"if 0"
> to the right with spaces. MPLAB gave exactly the same 2 errors on my test
file
> either way.
>
> I'm pretty sure Bob Barr has the correct explaination:
>
> Bob Barr <EraseMEbob_barrspamEraseMEHOTMAIL.COM> on 2001-05-22 02:16:01 PM explained:
> >An if..endif construct does work within a macro.
> >
> >It's actually the 'endm' within the if..endif that is causing the
problem.
> >It's not being ignored, it's terminating the macro prematurely. Upon
> >encountering the 'endm', the assembler stops storing the macro and starts
> >assembling 'normal' code.
> >
> >Since the 'if' was stored as part of the macro, the assembler then sees
what
> >it thinks is an unmatched 'endif' and reports that as an error. (It later
> >sees the unmatched 'endm' which results in that error as well.)

Note that if you want to "terminate" a macro conditionally, you can put
EXITM inside IF .. ENDIF.  I've got multiple examples of this in
STD.INS.ASPIC at http://www.embedinc.com/pic.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, @spam@olin@spam@spamspam_OUTembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\05\23@134656 by Douglas Wood

picon face
Any ideas why EXITM is emiited to the .LST file when NOLIST and NOEXPAND are
active? This doesn't happen with ENDM...

Douglas Wood
Software Engineer
spamBeGonedbwoodspamKILLspamkc.rr.com

Home of the EPICIS Development System for the PIC and SX
http://epicis.piclist.com

{Original Message removed}

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