Searching \ for '[PIC]: Label in macro problem. What's wrong?' 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=pic
Search entire site for: 'Label in macro problem. What's wrong?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Label in macro problem. What's wrong?'
2001\07\05@174902 by Thomas N

picon face
Hi everyone,

I saw many people's code uses label in their macro.  But when I try to use
it, MPLAB gives me this error:  "Error[116]   C:\TEMP\MACRO.ASM 5 : Address
label duplicated or different in second pass (here)"

What's wrong with my code?  What do I have to do to get around this
"problem"?

Thank you in advance!
Thomas

; in my main.asm file

       list p=16F877
       errorlevel -302

       org 0x00
       goto start
       org 0x04
       goto start

       include p16f877.inc
       include "macro.asm"

start
       call_test       function1
       call_test       function2
loop
       goto    loop

;----------------------------------------------
function1
       nop
       return
;----------------------------------------------
function2
       nop
       return

       end
=============================================
; in my macro.asm file
call_test       macro   label
       goto    here
       nop
here
       call    label
       endm
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

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


2001\07\05@180612 by Nick Veys

flavicon
face
A macro is inserted every place you use it in the program... So your
"here" label is being duplicated.

.....nickKILLspamspam@spam@veys.com | http://www.veys.com/nick


> {Original Message removed}

2001\07\05@182103 by myke predko

flavicon
face
Hi Thomas,

The problem is that the labels within the macro are not being declared as
"local".  "Local" is a directive which tells the macro assembler that this
label within the macro is only local to this macro and references to any
other labels with the same string should be ignored.

Using "local" try out this version of the macro:

call_test       macro   label
local here     ;  <-- "here" is now specific to inside macro
       goto    here
       nop
here
       call    label
       endm


{Original Message removed}

2001\07\05@210601 by Olin Lathrop

face picon face
> I saw many people's code uses label in their macro.  But when I try to use
> it, MPLAB gives me this error:  "Error[116]   C:\TEMP\MACRO.ASM 5 :
Address
> label duplicated or different in second pass (here)"

You have to use the LOCAL directive.  See STD.INS.PAS at
http://www.embedinc.com/pic for many examples.


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

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


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