C icon with asm code

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

Moderator: Benj

Post Reply
User avatar
psf
Posts: 45
Joined: Mon Jun 25, 2007 9:44 pm
Location: Italia
Has thanked: 6 times
Been thanked: 2 times
Contact:

C icon with asm code

Post 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?

User avatar
Bachman
Posts: 116
Joined: Sun Sep 07, 2014 11:37 am
Location: Hungary
Has thanked: 9 times
Been thanked: 53 times
Contact:

Re: C icon with asm code

Post by Bachman »

Try:

Code: Select all

SLEEP();
or

Code: Select all

Sleep();

User avatar
psf
Posts: 45
Joined: Mon Jun 25, 2007 9:44 pm
Location: Italia
Has thanked: 6 times
Been thanked: 2 times
Contact:

Re: C icon with asm code

Post by psf »

Yes, I know, but why should I use c if the description give also asm code?

User avatar
Bachman
Posts: 116
Joined: Sun Sep 07, 2014 11:37 am
Location: Hungary
Has thanked: 9 times
Been thanked: 53 times
Contact:

Re: C icon with asm code

Post 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

User avatar
psf
Posts: 45
Joined: Mon Jun 25, 2007 9:44 pm
Location: Italia
Has thanked: 6 times
Been thanked: 2 times
Contact:

Re: C icon with asm code

Post 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

User avatar
Bachman
Posts: 116
Joined: Sun Sep 07, 2014 11:37 am
Location: Hungary
Has thanked: 9 times
Been thanked: 53 times
Contact:

Re: C icon with asm code

Post by Bachman »


medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: C icon with asm code

Post 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?
Martin

User avatar
psf
Posts: 45
Joined: Mon Jun 25, 2007 9:44 pm
Location: Italia
Has thanked: 6 times
Been thanked: 2 times
Contact:

Re: C icon with asm code

Post by psf »

Perfect, now asm block works and compilation in XC compiler is 1 seconds long instead of >1 min od boostC

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: C icon with asm code

Post by medelec35 »

That's great.
Thank you for letting us know.
The advantages of XC8 are compile speed and regularly updating with newer targets.
Martin

Post Reply