Page 1 of 1

Problem with Nop blocks

Posted: Tue Apr 21, 2009 9:16 am
by laurent841
Hi,

I have some problems using Nop blocks. It seems that they aren't taken into account, even if I put values like 4000000 (1 second for my 4.00 MIPS configuration). It works fine when I use the Microchip C funtion Delay instead of Nop blocks, but I would like to use Nop blocks for very small delays.

Does anybody encountered the same problem ?

Thank you in advance,

Laurent

Re: Problem with Nop blocks

Posted: Tue Apr 21, 2009 7:54 pm
by LubinKerhuel
Hi Laurent,

The Nop Block must be placed between two others blocks, and connected on the ordering input/output of theses two blocks.

Post the simulink model if you have problems. Anyway, it is not adapted for 1s delay.

Lubin

Re: Problem with Nop blocks

Posted: Fri Apr 24, 2009 2:42 pm
by laurent841
Hi Lubin,

In fact I use Nop blocks for SPI communication,in order to respect waiting delays that are imposed. For 4.00 MIPS, when I put a block of 40 Nop (10 µs) between two SPI readings, delays are not taken into account when running the model on my dsPIC33. On the other hand, it does work fine when I use a C function call block that calls the function Delay(int), provided by Mirochip.

I don't understand why Nop blocks are not taken into account by the dsPIC. I join you a part of the model in order to illustrate the use of a Nop block.

Thank you for your help,
Kind regards,

Laurent

Re: Problem with Nop blocks

Posted: Wed May 06, 2009 11:04 pm
by LubinKerhuel
Hi Laurent,

That is strange as I use the nop function and it seems to work.
Could you post the .mdl file please ?
Did you loocked in the generated C file ?

Perhaps the compiler optimisation configuration removes nop instruction ?