Page 1 of 1

C icon with asm code

Posted: Mon Apr 18, 2022 6:46 pm
by psf
Using Flowcode 7 with a simple c icon:
ASM sleep
is not compiled.
If I use flowcode 6 OK. The complier is different and slower but works. what about?

Re: C icon with asm code

Posted: Mon Apr 18, 2022 7:02 pm
by Bachman
Try:

Code: Select all

SLEEP();
or

Code: Select all

Sleep();

Re: C icon with asm code

Posted: Mon Apr 18, 2022 7:45 pm
by psf
Yes, I know, but why should I use c if the description give also asm code?

Re: C icon with asm code

Posted: Mon Apr 18, 2022 8:06 pm
by Bachman
Because nothing to optimise on a simple instruction and doesn't matter, what you're using, C or ASM.

Code: Select all

_asm
    sleep
_endasm
or

Code: Select all

asm("sleep");
or

Code: Select all

_asm sleep _endasm

Re: C icon with asm code

Posted: Mon Apr 18, 2022 8:17 pm
by psf
_asm
movlw 0x88
movwf _intcon
movlw 0x06
movwf _ioc
sleep
nop
_endasm




809: _asm
^ (195) expression syntax
EXAMPLE.c:
921: mainendloop: goto mainendloop;
^ (374) missing basic type; int assumed (warning)
^ (314) ";" expected
922: }
^ (285) no identifier in declaration
^ (374) missing basic type; int assumed (warning)
^ (314) ";" expected
(908) exit status = 1

Re: C icon with asm code

Posted: Tue Apr 19, 2022 6:23 am
by Bachman

Re: C icon with asm code

Posted: Tue Apr 19, 2022 8:15 am
by medelec35
Hello
With Flowcode 7 and above XC8 compiler is used instead of BoostC
Therefore, what works with V6 assembly won't work with V7+
For example SFR must be in upper case.
In your case you can try

Code: Select all

#asm
movlw 0x88
movwf INTCON
movlw 0x06
movwf IOC
sleep
nop
#endasm
nop and sleep are not directly assembly, therefore

Code: Select all

NOP
and

Code: Select all

SLEEP
should also work.
What target device are you using?

Re: C icon with asm code

Posted: Tue Apr 19, 2022 5:43 pm
by psf
Perfect, now asm block works and compilation in XC compiler is 1 seconds long instead of >1 min od boostC

Re: C icon with asm code

Posted: Wed Apr 20, 2022 8:36 am
by medelec35
That's great.
Thank you for letting us know.
The advantages of XC8 are compile speed and regularly updating with newer targets.