# NOP instruction how much time it will take

#### sairfan1

Joined May 24, 2012
89
I'm writting some code for PIC uC using XC compiler, we can use macro NOP() for an empty instruction to execute, I believe it will take one cycle?
if uC is configured with 4Mhz clock how can I calculate duration that NOP instruction may take?

#### joeyd999

Joined Jun 6, 2011
5,035
I believe it will take one cycle?
One instruction cycle.

Which is 4 clock cycles.

#### sairfan1

Joined May 24, 2012
89
One instruction cycle.

Which is 4 clock cycles.
Sorry not good in math, that means 4 / 4,000,000 = 0.000001 uS
is that right?

#### Papabravo

Joined Feb 24, 2006
20,603
Sorry not good in math, that means 4 / 4,000,000 = 0.000001 uS
is that right?
YES! But, it is hardly worthy of the name MATH -- more like Arithmetic.

#### MrChips

Joined Oct 2, 2009
29,848
Sorry not good in math, that means 4 / 4,000,000 = 0.000001 uS
is that right?
No. Your units are wrong. It 4/4MHz = 1μs.

#### sairfan1

Joined May 24, 2012
89
No. Your units are wrong. It 4/4MHz = 1μs.
One more thing if I use 8Mhz clock instructions still would be 4, so 4 / 8MHz = 5ns

#### bertus

Joined Apr 5, 2008
22,232
Hello,

No, 4 ticks at 8 MHz is 500nS or 0.5 uS

Bertus

#### BobTPH

Joined Jun 5, 2013
8,104
It is really simple. When you invert a frequency in Hz, the answer is in seconds. When you invert a frequency in MHz the answer is in 1/1,000,000th seconds, or microseconds. Nanoseconds would pair with GHz.