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
I have done several projects with C166 and I don't remember ever having used _nop_() (or the assembeler instruction NOP for that matter). There are some pipeline effects where the instruction could be used, but these are rare and usually you can do something useful instead of putting in a NOP. Also, there could be a place for a few NOPs when generating a short pulse with an I/O pin and there is some minimum width for the pulse.
if not associated with I/O should never be there Erik never say never :)
Thanks all ! If i understand _nop_() function is used just for I/O. But in the example below, which NOP are necessary. Just 1 (or 2) for changing the state of the port direction, or all ?
void SetP8(void) { P8=0xFF; _nop_();_nop_(); DP8=0xFF; _nop_();_nop_(); }