EmbeddedRelated.com
Forums

ASM Macros

Started by Roberto Toca March 16, 2006
Hi,

            I'm trying to uncluter my programs using macros. This works
well
if I only call a macro once, but doing it twice generates a "Dupilicate
Label Error". According to an MSP430 Family Assembler Manual, the solution
is to
place a  ?  at the end of each label, but it doesn't work in my setup.

        I have the macro code in a file (MAC_Test.s43) and the code is:
Test     MACRO
            mov.w     #050000,R15
M_D   dec.w       R14                    ; Changing to M_D? doesn't affect
            jnz           M_D                  ; Changing to M_D? doesn't
affect
            ENDM

        In the program I can have:
        #include "MAC_Test.s43"

        bis.b   #001h,P1OUT        ; Turn LED on
        Test                                   ; Wait
        bic.b   #001h,P1OUT        ; Turn LED off

        Please tell me what is missing so as to have unique labels with
repeated uses of the macro.
        I've read many past mails but they center on C.

Thank you,

Fis. Roberto Toca Lazcano
TotalNeuro, S.A. de C. V.
Tel: +52 (55) 5534-6588
www.totalneuro.com
----- Original Message -----
From: "David Collier" <from_yahooMSP430@from...>
To: <msp430@msp4...>
Sent: Thursday, March 16, 2006 12:21 PM
Subject: Re: [msp430] TCP/RTOS/MSP


> > *Subject:* [msp430] TCP/RTOS/MSP
> > *From:* "William Sell" <w.sell@w.se...>
> > *To:* "Msp430" <msp430@msp4...>
> > *Date:* Thu, 16 Mar 2006 06:44:19 -0800
> >
> > Looks like I have a good chance at a contract for an application that
> > will
> > require the MSP to serve up a web page, reporting A/D values to a
>
> bloody hell... why?
>
> if you go for an ARM-based chip, you can practically pick that off the
> shelf.
>
> David
>
>
> Hi All
>
> I finally received the SAM7X evaluation board and found a few
> minutes to get a demo on-line.
>
> I put it in a DMZ so you can throw at it what you will!!
>
> Browse to http://212.254.22.36 and log on with name "ADMIN"
> password "AL6000S".
> Or FTP it at the same address. Or Telnet it if you wish (type in 3
> times "+" to get a prompt, then log in with
"ADMIN:AL6000S"). There
> are a number of menus which can be checked out.
> [Note only one FTP/TELNET link at a time but virtually no HTTP
> restrictions]
>
> Check out the board using web cam at http://212.254.22.36:8080 and
> you can control some LEDs from the I/O page of the web server: set 4
> ports as inputs/outputs and change their values when set as outputs.
>
> Code size is 40k in FLASH and 11,5k SRAM.
>
> I'm pleased with the chip. Everything worked smoothly and TCP/IP
> stack is as solid as a rock.
>
> Hope you enjoy checking it out.
>
> Cheers
>
> Mark Butcher
> www.mjbc.ch
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>


Beginning Microcontrollers with the MSP430

Hello Roberto,

Never used macros but I noticed you load R15 with 50000 decimal and decrement
R14 in your delay. 
Is that what you wanted?
Not too sure if the word Test is used elsewhere in the include files also so
maybe Test_ label instead also.

Just a thought

Dennis

RT> Hi,

RT>             I'm trying to uncluter my programs using macros. This
works well
RT> if I only call a macro once, but doing it twice generates a
"Dupilicate
RT> Label Error". According to an MSP430 Family Assembler Manual, the
solution
RT> is to
RT> place a  ?  at the end of each label, but it doesn't work in my
setup.

RT>         I have the macro code in a file (MAC_Test.s43) and the code is:
RT> Test     MACRO
RT>             mov.w     #050000,R15
RT> M_D   dec.w       R14                    ; Changing to M_D? doesn't
affect
RT>             jnz           M_D                  ; Changing to M_D?
doesn't
RT> affect
RT>             ENDM

RT>         In the program I can have:
RT>         #include "MAC_Test.s43"

RT>         bis.b   #001h,P1OUT        ; Turn LED on
RT>         Test                                   ; Wait
RT>         bic.b   #001h,P1OUT        ; Turn LED off

RT>         Please tell me what is missing so as to have unique labels with
RT> repeated uses of the macro.
RT>         I've read many past mails but they center on C.

RT> Thank you,

RT> Fis. Roberto Toca Lazcano
RT> TotalNeuro, S.A. de C. V.
RT> Tel: +52 (55) 5534-6588
RT> www.totalneuro.com
RT> ----- Original Message -----
RT> From: "David Collier" <from_yahooMSP430@from...>
RT> To: <msp430@msp4...>
RT> Sent: Thursday, March 16, 2006 12:21 PM
RT> Subject: Re: [msp430] TCP/RTOS/MSP


>> > *Subject:* [msp430] TCP/RTOS/MSP
>> > *From:* "William Sell" <w.sell@w.se...>
>> > *To:* "Msp430" <msp430@msp4...>
>> > *Date:* Thu, 16 Mar 2006 06:44:19 -0800
>> >
>> > Looks like I have a good chance at a contract for an application
that
>> > will
>> > require the MSP to serve up a web page, reporting A/D values to a

>> bloody hell... why?

>> if you go for an ARM-based chip, you can
practically pick that off the
>> shelf.

>> David


>> Hi All

>> I finally received the SAM7X evaluation board
and found a few
>> minutes to get a demo on-line.

>> I put it in a DMZ so you can throw at it what
you will!!

>> Browse to http://212.254.22.36 and log on with
name "ADMIN"
>> password "AL6000S".
>> Or FTP it at the same address. Or Telnet it if you wish (type in 3
>> times "+" to get a prompt, then log in with
"ADMIN:AL6000S"). There
>> are a number of menus which can be checked out.
>> [Note only one FTP/TELNET link at a time but virtually no HTTP
>> restrictions]

>> Check out the board using web cam at
http://212.254.22.36:8080 and
>> you can control some LEDs from the I/O page of the web server: set 4
>> ports as inputs/outputs and change their values when set as outputs.

>> Code size is 40k in FLASH and 11,5k SRAM.

>> I'm pleased with the chip. Everything
worked smoothly and TCP/IP
>> stack is as solid as a rock.

>> Hope you enjoy checking it out.

>> Cheers

>> Mark Butcher
>> www.mjbc.ch



>> .


>> Yahoo! Groups Links














RT> .

RT>  
RT> Yahoo! Groups Links



RT>  









Typo error,

Thank you,

Fis. Roberto Toca Lazcano
TotalNeuro, S.A. de C. V.
Tel: +52 (55) 5534-6588
www.totalneuro.com
----- Original Message -----
From: "Dennis McGrath" <dennis@denn...>
To: "Roberto Toca" <msp430@msp4...>
Sent: Thursday, March 16, 2006 7:45 PM
Subject: Re: [msp430] ASM Macros


> Hello Roberto,
>
> Never used macros but I noticed you load R15 with 50000 decimal and
decrement R14 in your delay.
> Is that what you wanted?
> Not too sure if the word Test is used elsewhere in the include files also
so maybe Test_ label instead also.
>
> Just a thought
>
> Dennis
>
> RT> Hi,
>
> RT>             I'm trying to uncluter my programs using macros.
This
works well
> RT> if I only call a macro once, but doing it
twice generates a
"Dupilicate
> RT> Label Error". According to an MSP430
Family Assembler Manual, the
solution
> RT> is to
> RT> place a  ?  at the end of each label, but it doesn't work in my
setup.
>
> RT>         I have the macro code in a file (MAC_Test.s43) and the code
is:
> RT> Test     MACRO
> RT>             mov.w     #050000,R15
> RT> M_D   dec.w       R14                    ; Changing to M_D?
doesn't
affect
> RT>             jnz           M_D              
   ; Changing to M_D?
doesn't
> RT> affect
> RT>             ENDM
>
> RT>         In the program I can have:
> RT>         #include "MAC_Test.s43"
>
> RT>         bis.b   #001h,P1OUT        ; Turn LED on
> RT>         Test                                   ; Wait
> RT>         bic.b   #001h,P1OUT        ; Turn LED off
>
> RT>         Please tell me what is missing so as to have unique labels
with
> RT> repeated uses of the macro.
> RT>         I've read many past mails but they center on C.
>
> RT> Thank you,
>
> RT> Fis. Roberto Toca Lazcano
> RT> TotalNeuro, S.A. de C. V.
> RT> Tel: +52 (55) 5534-6588
> RT> www.totalneuro.com
> RT> ----- Original Message -----
> RT> From: "David Collier" <from_yahooMSP430@from...>
> RT> To: <msp430@msp4...>
> RT> Sent: Thursday, March 16, 2006 12:21 PM
> RT> Subject: Re: [msp430] TCP/RTOS/MSP
>
>
> >> > *Subject:* [msp430] TCP/RTOS/MSP
> >> > *From:* "William Sell" <w.sell@w.se...>
> >> > *To:* "Msp430" <msp430@msp4...>
> >> > *Date:* Thu, 16 Mar 2006 06:44:19 -0800
> >> >
> >> > Looks like I have a good chance at a contract for an
application that
> >> > will
> >> > require the MSP to serve up a web page, reporting A/D values
to a
>
> >> bloody hell... why?
>
> >> if you go for an ARM-based chip, you can practically pick that off
the
> >> shelf.
>
> >> David
>
>
> >> Hi All
>
> >> I finally received the SAM7X evaluation board and found a few
> >> minutes to get a demo on-line.
>
> >> I put it in a DMZ so you can throw at it what you will!!
>
> >> Browse to http://212.254.22.36 and log on with name
"ADMIN"
> >> password "AL6000S".
> >> Or FTP it at the same address. Or Telnet it if you wish (type in 3
> >> times "+" to get a prompt, then log in with
"ADMIN:AL6000S"). There
> >> are a number of menus which can be checked out.
> >> [Note only one FTP/TELNET link at a time but virtually no HTTP
> >> restrictions]
>
> >> Check out the board using web cam at http://212.254.22.36:8080 and
> >> you can control some LEDs from the I/O page of the web server: set
4
> >> ports as inputs/outputs and change their values when set as
outputs.
>
> >> Code size is 40k in FLASH and 11,5k SRAM.
>
> >> I'm pleased with the chip. Everything worked smoothly and
TCP/IP
> >> stack is as solid as a rock.
>
> >> Hope you enjoy checking it out.
>
> >> Cheers
>
> >> Mark Butcher
> >> www.mjbc.ch
>
>
>
> >> .
>
>
> >> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> RT> .
>
> RT>
> RT> Yahoo! Groups Links
>
>
>
> RT>
>
>
>
>
>
>
> 
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>


To use repeatedly:

Test     MACRO
            mov.w     #050000,R15
M_D   dec.w       R15                    ; Changing to M_D? doesn't affect
            jnz           M_D                  ; Changing to M_D? doesn't
affect
            ENDM

it should be writen:

Test     MACRO
            LOCAL   M_D  
            mov.w     #050000,R15
M_D   dec.w       R14                    
            jnz           M_D          
            ENDM

IAR V4