前文中,有一个叫 _nop_ 的函数,我不知道是干什么的,特意到QQ上问了问,一个哥们给了一段东西,原来叫“空指令”,作用就是占用一个CPU运算周期,呵呵,特意把原文贴上来,同时感谢那位朋友。
#include <intrins.h>
void _nop_ (void);
Description:
The _nop_ routine inserts an 8051 NOP instruction into the program. This routine can be used to pause for 1 CPU cycle. This routine is implemented as an intrinsic function. The code required is included in-line rather than being called.
Return Value:
None.
Attributes:
reentrant, intrinsic
See Also:
-
Example
#include <intrins.h>
#include <stdio.h> /* for printf */
void tst_nop (void) {
P1 = 0xFF;
_nop_ (); /* delay for hardware */
_nop_ ();
_nop_ ();
P1 = 0x00;
}