calling a macro from assembler

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Dave S
Posts: 39
Joined: Tue Jun 07, 2011 12:37 pm
Has thanked: 12 times
Been thanked: 5 times
Contact:

calling a macro from assembler

Post by Dave S »

Hi,

I am having problems calling a macro from within asm. The help file says to call _FCM_MACRO() but the compiler doesn't like it.

asm
{
call _FCM_MACRO()
}

Any ideas on what I'm doing wrong please? (the name MACRO is just an example).

Thanks,

Dave.

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: calling a macro from assembler

Post by JonnyW »

Hi Dave. After a bit of experimentation the syntax seems to be:

Code: Select all

  asm
  {
    call FCM_macro
  }
This is case sensitive (the macro was created lower case) and does not have closing brackets. I am not familiar with PIC assembly but Im assuming you will have to push each argument you need first. You can view the C code and cut-paste the exact definition from there.
grab.png
Snapshot of icon
(11.87 KiB) Downloaded 2245 times
Out of curiosity, may I as what you are doing to require calling a macro from assembly?

Cheers,

Jonny

Dave S
Posts: 39
Joined: Tue Jun 07, 2011 12:37 pm
Has thanked: 12 times
Been thanked: 5 times
Contact:

Re: calling a macro from assembler

Post by Dave S »

Hi Jonny,

Thanks for that, I'll try it first thing in the morning. (Doesn't agree with the help file though!)

I've written a routine in assembler which receives data from a transmitter and I want to output the data via RS232 to check it has been received correctly using the flowcode macro.

I'll let you know how it goes.

Thanks again,

Dave.

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: calling a macro from assembler

Post by JonnyW »

Yeah - different C compilers have slightly different ASM syntax. It may have been that the help file documented a way to do it with one compiler which differed from another, or that the compiler documented used to behave like that but doesnt any more. We will hopefully try to make things like this clear in the future.

Its always difficult with ASM to pinpoint exact syntax as it varies so much from chip to chip and compiler to compiler. Thats why I was suprised that you were calling Flowcode macros from ASM, as it will be difficult to port, but thats the only reason really and there is no reason why you shouldnt be able to do this.

Good luck with the code,

Jonny

Dave S
Posts: 39
Joined: Tue Jun 07, 2011 12:37 pm
Has thanked: 12 times
Been thanked: 5 times
Contact:

Re: calling a macro from assembler

Post by Dave S »

Hi Jonny,

Your syntax works fine, thanks again.

I'm not sure what you meant by "I am not familiar with PIC assembly but Im assuming you will have to push each argument you need first. You can view the C code and cut-paste the exact definition from there"

The line "call FCM_macro" can be inserted into the assembler and works as is.

Porting will not be a problem, I just want to output RS232 for debug purposes.

Dave.

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: calling a macro from assembler

Post by JonnyW »

I'm not sure what you meant by "I am not familiar with PIC assembly but Im assuming you will have to push each argument you need first. You can view the C code and cut-paste the exact definition from there"
Dont worry about it - I meant if you were calling a macro with multiple arguments, or using a different macro name, which youre not. Glad it all works OK.

Jonny

Post Reply