Page 1 of 1

assembler in FC7

Posted: Wed Feb 08, 2023 1:45 pm
by DELAK_ALED
In flowcode 6 I have no problem sending an assembler program to hardware (see example in attachment). However, in flowcode 7 I can't do that. Does anyone know how to modify the program so that I can also use that assembler program in flowcode 7?
Thanks in advance for helping to find a solution.

asm
{
movlw 0b00000000
movwf _trisd
movlw 0b10101010
movwf _portd
}

Re: assembler in FC7

Posted: Wed Feb 08, 2023 2:59 pm
by Steve
Hopefully this post will help:
viewtopic.php?f=63&t=22957

Re: assembler in FC7

Posted: Fri Feb 10, 2023 9:35 am
by DELAK_ALED
It has indeed helped me a lot. I only have a problem if I want to use a variable in my program.
How can I do that in FC7?

in FC6 this works well

unsigned char test;
asm
{
movlw 0b00000000
movwf _trisd
movlw 10
movwf _test
movff _test,_portd
}

in FC7 a problem occurs and it only has to do with that variable

unsigned char test;
#asm
movlw 0b00000000
movwf trisd
movlw 10
movwf test
movff test,portd
#endasm

Re: assembler in FC7

Posted: Fri Feb 10, 2023 10:19 am
by chipfryer27
Hi

In FC7 naming changed to capitals. If I had a variable called "test", I would if using a C-code block reference it with FCV_TEST

HTH

Regards

EDIT..
Oops, forgot you were using asm but Steve to the rescue :)

Re: assembler in FC7

Posted: Fri Feb 10, 2023 10:32 am
by Steve
Please see the attached and image below.

It contains 4 equivalent icons showing variable assignment: Flowcode, C code and two in Assembly code.

There are 2 assembly code versions. The first is a copy of how C code statements are converted to assembly by the compiler (I found this by looking at the generated ".as" file after I did a compile). The second is a simplified version, but note it might not work because of various complications in the compilation process (due to optimisations, etc). The XC8 manual has much more information on this.
c code test.png
c code test.png (20.72 KiB) Viewed 11327 times

Re: assembler in FC7

Posted: Fri Feb 10, 2023 11:00 am
by DELAK_ALED
Thank you to everyone who helped me tremendously here