Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MPLAB Macro how to tell if parameter is a literal ?

Status
Not open for further replies.

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.
 
Status
Not open for further replies.

Latest threads

Back
Top