Inline assembly in FC7

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
Andreas
Posts: 17
Joined: Tue Jan 17, 2017 6:10 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

Inline assembly in FC7

Post by Andreas »

Hi

I have until now been using FC5, and therefore have a lot of old programs programs, which is programmed in FC5. Unfortunately i do no longer have access to my former FC5 licens, and i am now started to use FC7, starting with the 30 days trial.

In some of my programs i have inline assembly code, but this code made in FC5 seems to create a lot of troubles in FC7.

The code would look something like this:

Code: Select all

asm{
send1:   BSF  _porta, 0
         NOP 
         NOP
         NOP
         BCF _porta, 0
slut1:   END
}
During compiling, something like the following error appeared
"(" expected
string expected
")" expected
I found out that a solution on the error could be found by changing the code to

Code: Select all

asm(
"send1:   BSF  _porta, 0"
         "NOP" 
         "NOP"
         "NOP"
         "BCF _porta, 0"
"slut1:   END"
);
But this just caused another error saying
syntax error
Undefined symbol "0NOPNOPNOPNOPBCF"
And in the generated assembly-code, everything in the assembly-block seems to be squeezed together on 1 single line like:
send1: BSF _porta, 0NOPNOPNOPNOPBCF _porta, 0slut1: END ;#
I hope someone here can tell me what is happening and how to use inline assembly in FC7

Andreas

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Inline assembly in FC7

Post by LeighM »

try this...

Code: Select all

asm(
"send1:   BSF  PORTA, 0\n"
         "NOP\n"
         "NOP\n"
         "NOP\n"
         "BCF PORTA, 0\n"
);

Andreas
Posts: 17
Joined: Tue Jan 17, 2017 6:10 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Inline assembly in FC7

Post by Andreas »

Hi

Thanks for the answer.

I read the manual for mplab XC8 compiler and found out that using #asm and #endasm was solving my problem. Unfortunately this lead to other syntax-errors, but i found a workaround and now everything works fine.

Post Reply