S12DP512 8MHz Bus - NOP processing time

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12DP512 8MHz Bus - NOP processing time

5,134 Views
pon
Contributor I
i am using HCS12 16 bit 8MHz microcontrller. can anyone give me the porcessing time of the asm "nop" instruction?


--
Alban Edit: Please always include FSL Part Number in Message Subject line.



Message Edited by Alban on 2007-09-20 11:20 AM

Message Edited by Alban on 2007-09-20 12:15 PM
Labels (1)
0 Kudos
Reply
7 Replies

1,943 Views
Alban
Senior Contributor II
Hello,

It depends on MANY factors.

With a PLL you can get 33MHz bus (or 25MHz, see datasheet). So NOP = 30.3ns.
If XTAL is 8MHz and no PLL, then bus = 4MHz. So NOP = 250ns.
if bus = 8MHz. NOP = 125ns
With PLL to get 1MHz bus, NOP = 1µs.

With amount details you give, answer is 30.3ns < tNOP < 1µs.

Cheers,
Alban.
0 Kudos
Reply

1,943 Views
pon
Contributor I
The controller i use is MC9S12DP512.  i guess that PLL is 16MHz and the bus is 8MHz. so NOP is 125 ns. am i right? when i make delay in program using NOP its giving me wrong delay. i am using NOP within loop in C to make dely..  should i calculate loop timing also?
0 Kudos
Reply

1,943 Views
Alban
Senior Contributor II
Hey Pon,

Yes, 125ns is right. You also need to count the time of the Branch (BNE)

TotalDelay = (tNOP + tBranch) * NbLoop

When you compile, in the LIST file, you can have within square brackets the number of clock cycles for each instruction.

Alban.

      

0 Kudos
Reply

1,943 Views
pon
Contributor I
thanks a lot!! anyhow i could not find the clock cycle deatils in LIST. here are part of the code form list, is A7 is clock cycle needed for NOP?

TIMER_EXTERN void delay10us (void)
 0022           ; {
 0022           ;  
 0022           ;     asm("nop");asm("nop");asm("nop");asm("nop");
 0022 A7                nop
 0023 A7                nop
 0024 A7                nop
 0025 A7                nop
 0026           ;       asm("nop");asm("nop");asm("nop");asm("nop");
 0026 A7                nop
 0027 A7                nop
 0028 A7                nop
 0029 A7                nop
 002A           ;       asm("nop");asm("nop");asm("nop");asm("nop");
 002A A7                nop
 002B A7                nop
 002C A7                nop
 002D A7                nop
 002E           ;       asm("nop");asm("nop");asm("nop");asm("nop");
 002E A7                nop
 002F A7                nop
 0030 A7                nop
 0031 A7                nop
 0032           ;       asm("nop");asm("nop");asm("nop");asm("nop");
 0032 A7                nop
 0033 A7                nop
 0034 A7                nop
 0035 A7                nop
 0036           ;       asm("nop");asm("nop");asm("nop");asm("nop");
 0036 A7                nop
 0037 A7                nop
 0038 A7                nop
 0039 A7                nop
 003A           L2:
 003A                   .dbline 0 ; func end
 003A 3D                rts
 003B           ;              i -> 0,SP
 003B           ;           time -> 2,SP
 003B           _smallDelay::
 003B 3B                pshd
 003C 1B9E              leas -2,S
 003E           ;  
 003E           ;   }
0 Kudos
Reply

1,943 Views
Alban
Senior Contributor II
Hey Pon,

No A7 is the OPCODE in HEXADECIMAL.
The 0022 is the ADDRESS.

In a nutshell, A7 is the data located at $0022.

You have 6 times 4 NOP = 24 NOP = 125ns * 4 = 0.5µs.

I don't understand why there is an RTS in the delay10us() function.

Alban.


0 Kudos
Reply

1,943 Views
pon
Contributor I
i confused by the sentence "You have 6 times 4 NOP = 24 NOP = 125ns * 4 = 0.5µs." ,
 i guess 25ns * 24 = 3µs.

RTS is comming after end of the delay10us() function. i coppied little remainig parts too.
0 Kudos
Reply

1,943 Views
Alban
Senior Contributor II
Ok, yes 3µs, I dropped 20 :smileysurprised:

So either you do a loop, either you extend the number of NOP to reach 10µs.
0 Kudos
Reply