Assembly in C

Hello members,

I am using MSP430F1611 for my project with CrossStudio. I need to use assembly instructions in between my C code like,

void Wait(unsigned int delay)

{

unsigned int c;

for(c=0;c<delay;c++)

{

//asm(“nop”);

}

}

But above use of “asm” is giving compilation error. I am finding it bit difficult to find the proper document for this. Has anyone used this earlier with CrossStudio? A document will be much helpful.

Thanks in advance.

If you want a delay using CrossStudio, here is the function that will do that:

#include <inmsp.h>

void __delay_cycles(unsigned long n);

This “delays program execution for exactly n processor cycles. n must be a constant.”

If you still want to use the nop, then just use the function

_NOP(); // note the prepended underscore

HTH,

gm