Content originally posted in LPCWare by deBoogle on Sun Feb 20 04:45:49 MST 2011
Hi there,
Does anyone know of creating a very small (10ns) delay. By my calculations one instruction (depending on actual instrction) should take 10ns with CPU = 100MHz. So I figured use asm and put in a NOP. But some sources I have read suggest this may be removed from instruction pipeline by the CPU.
I have seen the __NOP() function in the CMIS coreM3.h file, but this still uses quite a few (5 or 6) instructions to do the stack pushing and popping. Is it safe for me just to put in an inline asm NOP??
As an aside is there anyway of counting total clk cycles used in a delay within LPCXpresso? I have been stepping through the instructions, but the questions is, is one step = 1 clk cycle??? I think it is more likely 1 step = 1 instrction execution regardless of clk cycles used to execute said instruction.
thanks
deBoogle