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
  • Do I get you right? The assembler code is ok but the measurement is wrong.

    Here's kind of a truth table:
    1. and 2. _nop_() are set: high=100ns, low=150ns
    Only 1. _nop_() is set: high=100ns, low=100ns
    Only 2. _nop_() is set: high=100ns, low=150ns
    Neither _nop_() is set: high=100ns, low=100ns

    Fabian

Reply
  • Do I get you right? The assembler code is ok but the measurement is wrong.

    Here's kind of a truth table:
    1. and 2. _nop_() are set: high=100ns, low=150ns
    Only 1. _nop_() is set: high=100ns, low=100ns
    Only 2. _nop_() is set: high=100ns, low=150ns
    Neither _nop_() is set: high=100ns, low=100ns

    Fabian

Children