What is the maximum size of the arguments that are passed to macros?If it is greater than 1 byte how can we store it in different registers or memory location? I want to pass an argument which can have maximum value of 1000 to a macro. The macro has to store the lower byte in TMR3l and higher byte in TMR3H. How can I do this?
You did not say which processor/assembler combination you are using. TMR3 sounds lik the name of a timer in one of the PIC variants.
To answer the question you break it up into its component parts. The low order eight bits are extracted with an expression like
Code:
movlw timeValue & 0xFF
The high order eight bits can be obtained with
Code:
movlw timeValue >> 8
The double angle bracket operator means that timeValue should be shifted to the right. The literal '8' says how many places to shift right. In most cases this will be an arithmetic shift rather than a logical shift. Experimentation is in order if the documentation is unclear, ambiguous, or does not address the issue.
Since the assembler's expression arithmetic is done with 32 bit unsigned numbers you can extract additional bytes wirh