Is any one else having a problem when calling macros? My code doesn't seem to work properly with macros especially when there are inline subroutines within it. (I am on PIC18)

Views: 244

Reply to This

Replies to This Discussion

the issue itself seems vague but as a general note macros are not called but are physically written in memory when the macro is referenced in code and a little more care has to be taken when trying to address in ways like goto $+x around it? (I have no idea if this is your issue or not, sorry if it didn't help!)

 

 yeah had the same problem when calling macros within subroutines (PIC18 as well)... just ended up replicating code. If anyone finds a solution it's greatly appreciated

 

if you have labels inside your macro, make them "local" at the beginning

E.g. macro MacroName parameter1,..., parameter
local LabelName1,LabelName2


LabelName1
;code...
;...

It gets an error when it reaches the label (or sub routine name) more than once when you call the macro multiple times (duplicate labels)

hey so i figured it out...when using subroutines within macros make sure to branch to them (instead of using call or goto)...hope this helps cheers

RSS

© 2024   Created by PML.   Powered by

Badges  |  Report an Issue  |  Terms of Service