MPLAB Macro how to tell if parameter is a literal ?

bean

New Member
I want to make a macro and in part of it I need to the parameter into W.
If the parameter is a literal I need to do "MOVLW param1", but if it is a register I need to do "MOVF param1,W".
How can I determine what was passed ?

Thanks, Bean
 
Bean
One way is to add another parameter to your macro which is then the 'switch' to select either the MOVLW or the MOVF instruction. This works for me because i know
at the time i insert the macro in the code what is required.
 
Lourens,
Thanks.
Another question. In my macro I have
Code:
  if source <> "W"
    movf source,w
  endif
But I keep getting a "missing argument(s)" error on the "if" line.

Bean
 
Bean
<> is not a valid arithmetic operator in mpasm, you must use != This info i got from an old MPASM USERS GUIDE DS33014G page 179.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…