>-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >Sent: 09 May 2005 14:15 >To: Microcontroller discussion list - Public. >Subject: [PIC] : 18F, Macros and reusing labels inside > > >I thought I read somewhere...here or elsewhere, that >with the 18F series you can reuse labels inside a >macro? > >I built and tested some macros then went to implement >them in a few places and came up with duplicate labels >upon building the file. > >So, can you do this, and if so, whats the trick? > >example as follows...on a 18F4680 > >min_value macro cMSB,compMSB,cLSB,compLSB > > movf cMSB,w > cpfsgt compMSB > bra _minTstLsb > movff cMSB,compMSB > movff cLSB,compLSB > bra _minDone >_minTstLsb > movf cLSB,w > cpfsgt compLSB > bra _minDone > movff cMSB,compMSB > movff cLSB,compLSB >_minDone > endm You have to use the LOCAL keyword. From the MPASM help file: len equ 10 ; global version size equ 20 ; note that a local variable ; may now be created and modified test macro size local len, label ; local len and label len set size ; modify local len label res len ; reserve buffer len set len-20 endm ; end macro Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist