EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Assembler code into C rutine in IAR software

Started by vazquez_ari January 27, 2004
Hi,
I have a problem.

I want to insert assembler code into C rutine in IAR compiler.
I prove with #asm and #noasm but no function.

How do I do?

Help me

Ariel


Beginning Microcontrollers with the MSP430

"vazquez_ari" <avazquez@avaz...> writes:

> Hi,
> I have a problem.
> 
> I want to insert assembler code into C rutine in IAR compiler.
> I prove with #asm and #noasm but no function.
> 
> How do I do?
> 
> Help me

You can do one of two things:

1) Use inline assembler, for example:

    void test()
    {
      asm("nop");
      asm("nop");
      asm("nop");
    }

Or, even better, write your routine in assembler and call it from C.
There is an entire chapter in the manual that covers this.

    -- Anders Lindgren, IAR Systems
-- 
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

You can use the _OPC() instruction to insert op codes
directly to memory. 
Search for this instruction in the help of IAR. To
quickly know the instruction opcodes use the debug
mode and watch the program listing in assembler wich
will put line in C and assembler the next and so on.
Good luck!



--- vazquez_ari <avazquez@avaz...> escribi 
---------------------------------
Hi,
I have a problem.

I want to insert assembler code into C rutine in IAR
compiler.
I prove with #asm and #noasm but no function.

How do I do?

Help me

Ariel



.





---------------------------------
.
 

------------
Los mejores usados y las m tentadoras 
ofertas de 0km est en Yahoo! Autos.
Compro vendtu auto en
http://autos.yahoo.com.ar


The 2024 Embedded Online Conference