Sign in

username:

password:



Not a member?

Search rabbit-semi



Search tips

Subscribe to rabbit-semi



Ads

Discussion Groups

See Also

DSPFPGAElectronics

This is a group for folks designing and programming embedded systems using the Rabbit Semiconductor C-programmable microcontroller. Rabbit Semi is a spin-off from Z-World who makes a variety of embedded modules and tools. This group is not affiliated with either Rabbit or Z-World, but is a user forum for sharing ideas, asking questions, flaunting knowledge, and other typical user group stuff. The Rabbit is a powerful uC, supported by a full-featured C-compiler.

Macro Math - Shawn - Jun 11 13:43:09 2009

I have a macro in assembly that I pass a number to. I can pass this number to the macro, no problem, that works fine. The problem I run into is if I try to increment this number. The code looks like this:

// this is in assembly!
#define macro1(datatest,bittest) $\
anothermacro(datatest,2*bittest) $\
anothermacro(datatest,2*bittest+1)

Inside my macro, I want to nest some other macros, in an attempt to make programming easier (but with tight timing). But when I compile, I get "unexpected token", and that error goes away when I remove the math that I apply to bittest.

Is there a way around this? Or am I seeing some other error?

Shawn

------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )


Re: Macro Math - Shawn - Jun 11 14:33:57 2009

I decided to just expand out my code a bit, and do this instead:

// this is in assembly!
#define macro1(datatest,bittest1,bittest2) $\
anothermacro(datatest,bittest1) $\
anothermacro(datatest,bittest2)

Not quite what I wanted, but good enough to get me by.

Shawn

-- In r...@yahoogroups.com, "Shawn" wrote:
>
> I have a macro in assembly that I pass a number to. I can pass this number to the macro, no problem, that works fine. The problem I run into is if I try to increment this number. The code looks like this:
>
> // this is in assembly!
> #define macro1(datatest,bittest) $\
> anothermacro(datatest,2*bittest) $\
> anothermacro(datatest,2*bittest+1)
>
> Inside my macro, I want to nest some other macros, in an attempt to make programming easier (but with tight timing). But when I compile, I get "unexpected token", and that error goes away when I remove the math that I apply to bittest.
>
> Is there a way around this? Or am I seeing some other error?
>
> Shawn
>

------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Macro Math - Robert Richter - Jun 11 18:34:50 2009

When I use macros in assembly, I sometimes put "0+macro" so that if the macro has parentheses in it, it won't be misinterpret as reading from a memory address.

--- In r...@yahoogroups.com, "Shawn" wrote:
>
> I decided to just expand out my code a bit, and do this instead:
>
> // this is in assembly!
> #define macro1(datatest,bittest1,bittest2) $\
> anothermacro(datatest,bittest1) $\
> anothermacro(datatest,bittest2)
>
> Not quite what I wanted, but good enough to get me by.
>
> Shawn
>
> -- In r...@yahoogroups.com, "Shawn" wrote:
> >
> > I have a macro in assembly that I pass a number to. I can pass this number to the macro, no problem, that works fine. The problem I run into is if I try to increment this number. The code looks like this:
> >
> > // this is in assembly!
> > #define macro1(datatest,bittest) $\
> > anothermacro(datatest,2*bittest) $\
> > anothermacro(datatest,2*bittest+1)
> >
> > Inside my macro, I want to nest some other macros, in an attempt to make programming easier (but with tight timing). But when I compile, I get "unexpected token", and that error goes away when I remove the math that I apply to bittest.
> >
> > Is there a way around this? Or am I seeing some other error?
> >
> > Shawn
>

------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )