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_()

Hi,

I have just taken a project already started on the ST10F168. My problem is to understand when I am obliged to use the _nop_() function. Because in my project, it's using in abundance...Is it really necessary ??

When you set a port or a state(input/output), do you put a _nop_() (or 2) after ??
In general, when the use of this function is necessary ??

Thanks in advance

Regards

JM

Parents
  • If it seems that there are too manu NOPs, there probably are. All the pipeline side effects are described in the microcontroller manual, and there are not many. One of the most important ones is when you want to disable interrupts: after the BCLR IEN instruction you have to wait for two or three NOPs before you can put the uniterruptable instruction sequence in.
    You can read the microcontroller manual to see if those NOPs are necessary or you can just leave them there and mark them with the comment /* just in case */.

    Regards,
    - mike

Reply
  • If it seems that there are too manu NOPs, there probably are. All the pipeline side effects are described in the microcontroller manual, and there are not many. One of the most important ones is when you want to disable interrupts: after the BCLR IEN instruction you have to wait for two or three NOPs before you can put the uniterruptable instruction sequence in.
    You can read the microcontroller manual to see if those NOPs are necessary or you can just leave them there and mark them with the comment /* just in case */.

    Regards,
    - mike

Children
No data