This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

_nop_() does not work

Hi forum!
I need a delay in a programm but _nop_() seems not to work. Thus I wrote the following code in the main function where x is an IO pin:

while(1)
{
x = 1;
_nop_();
x = 0;
_nop_();
}

Only the second _nop_() causes a delay but not the first one. µVsioin2 is used. Can anybody help me?

Thanks Fabian

Parents
  • I'm really sorry guys, but I still don't understand what I'm doing wrong.

    Tell us what you are trying to achieve.
    With the C166 CPU core (and even more so with the C166 v2 core) you cannot expect program execution time to be a simple arithmetic sum of execution times of each instruction because of things like CPU pipeline, jump cache and so on.
    By the way, what microcontroller are you using? Is it the older C16x family, or the newer XC16x family?

    Regards,
    - mike

Reply
  • I'm really sorry guys, but I still don't understand what I'm doing wrong.

    Tell us what you are trying to achieve.
    With the C166 CPU core (and even more so with the C166 v2 core) you cannot expect program execution time to be a simple arithmetic sum of execution times of each instruction because of things like CPU pipeline, jump cache and so on.
    By the way, what microcontroller are you using? Is it the older C16x family, or the newer XC16x family?

    Regards,
    - mike

Children
No data