may someone please tell me this doesn't work in mikroc but it does in maplab xc8 .
void function()
{
PORTD=~PORTD;
}
void main()
{
TRISD=0;
PORTD=0;
while(1) asm goto _function;
}
asm goto _function
- uros.cvetinovic
- mikroElektronika team
- Posts: 803
- Joined: 14 Dec 2015 09:24
Re: asm goto _function
Hi,
You did not call function() in the main, so the compiler didn't link it.
Therefore the goto can not find function().
Try like this, you will see it will work:
Best regards,
Uros
You did not call function() in the main, so the compiler didn't link it.
Therefore the goto can not find function().
Try like this, you will see it will work:
Code: Select all
void function()
{
PORTD=~PORTD;
}
void main()
{
TRISD=0;
PORTD=0;
function();
while(1) asm goto _function;
}
Uros
Re: asm goto _function
its working thank you
Uros
Uros
Re: asm goto _function
The #pragma funcall directive instructs linker to add function even if it's not called directly - you may use it in this case as well:
Code: Select all
#pragma funcall main your_function
- uros.cvetinovic
- mikroElektronika team
- Posts: 803
- Joined: 14 Dec 2015 09:24
Re: asm goto _function
Hi Janni,
Yes, that is right, this also can be used.
Best regards,
Uros
Yes, that is right, this also can be used.
Best regards,
Uros