解释INTRINS.H Intrinsic functions for C51. Copyright (c) 1988-2010 Keil Elektronik GmbH and ARM Germany GmbH All rights reserved. --------------------------------------------------------------------------*/ #ifndef __INTRINS_H__ #define __INTRINS_H__ #pragma SAVE #if defined (__CX2__) #pragma FUNCTIONS(STATIC) /* intrinsic functions are reentrant, but need static attribute */ #endif extern void _nop_ (void); extern bit _testbit_ (bit); extern unsigned char _cror_ (unsigned char, unsigned char); extern unsigned int _iror_ (unsigned int, unsigned char); extern unsigned long _lror_ (unsigned long, unsigned char); extern unsigned char _crol_ (unsigned char, unsigned char); extern unsigned int _irol_ (unsigned int, unsigned char); extern unsigned long _lrol_ (unsigned long, unsigned char); extern unsigned char _chkfloat_(float); #if defined (__CX2__) extern int abs (int); extern void _illop_ (void); #endif #if !defined (__CX2__) extern void _push_ (unsigned char _sfr); extern void _pop_ (unsigned char _sfr); #endif #pragma RESTORE #endif
时间: 2023-10-21 18:07:19 浏览: 87
这段代码是关于C51芯片的Intrinsic函数的头文件,Intrinsic函数是指直接嵌入到程序中的函数,不需要进行函数调用,在编程中可以提高效率。该文件定义了一些Intrinsic函数,比如_nop_、_testbit_、_cror_、_iror_、_lror_、_crol_、_irol_、_lrol_等等,这些函数可以直接在程序中使用。此外,该文件还定义了一些宏,如SAVE、FUNCTIONS、RESTORE等,用于在编译时控制函数的属性和行为。
相关问题
keil报错D:\SProgram Files\Keil5\C51\Inc\intrins.h contains an incorrect path
首先,您可以按照以下步骤检查和解决该问题:
1. 确保在您的工程文件中正确调用了头文件,即检查工程中的`#include`语句是否正确。根据引用中的建议,您需要将`#include <intrins.h>`和`<reg52.h>`改为`#include "intrins.h"`和`"reg52.h"`。这样做的原因是`" "`可以更大范围地查找头文件,以避免引用路径错误。
2. 在Keil中,点击魔术棒(或者选择Options -> C51),进入C51窗口,然后点击"Include Paths"选项。根据引用中的建议,您需要将Keil文件安装目录下的C51文件夹所在目录添加到Include Paths中。这样做可以确保Keil能够正确找到intrins.h头文件。
3. 重新启动Keil 51,然后尝试再次编译您的工程。这样做可以确保之前所做的更改生效。
如果您仍然遇到相同的错误信息,可能是由于intrins.h头文件包含的路径不正确导致的。在这种情况下,您可以尝试以下方法:
4. 打开intrins.h头文件(位于D:\SProgram Files\Keil5\C51\Inc\目录下),检查文件中是否包含了正确的路径。如果路径不正确,您可以手动修改intrins.h头文件中的路径,将其指向正确的位置。
5. 如果修改intrins.h头文件并不可行,您可以尝试使用引用中提到的方法,即将正确的intrins.h头文件所在的目录导入到Keil中。这样做可以确保Keil能够正确找到并引用intrins.h头文件。
请注意,根据引用中的描述,intrins.h是8051微控制器的一个库文件,其中定义了一些函数和指令。因此,确保您的工程适用于8051微控制器。
综上所述,您可以按照以上步骤检查和解决Keil报错的问题。希望这些信息对您有所帮助!如果您有任何其他问题,请随时提问。
流水灯intrins.h c语言
在C语言中,`intrins.h` 库用于调用一些内部嵌入式处理器指令。以下是使用 `intrins.h` 库实现流水灯的 C 语言程序:
```c
#include <intrins.h>
#include <reg51.h>
sbit LED1 = P1^0;
sbit LED2 = P1^1;
sbit LED3 = P1^2;
sbit LED4 = P1^3;
void Delay(unsigned int i) {
while (i--) {
_nop_(); // 空操作
_nop_();
_nop_();
}
}
int main() {
while (1) {
LED1 = 1;
Delay(500);
LED1 = 0;
LED2 = 1;
Delay(500);
LED2 = 0;
LED3 = 1;
Delay(500);
LED3 = 0;
LED4 = 1;
Delay(500);
LED4 = 0;
}
return 0;
}
```
在这个程序中,使用了 `intrins.h` 库中的 `_nop_()` 函数来实现延时。`_nop_()` 函数是一种空操作指令,它会让程序在不做任何操作的情况下等待一定时间,从而实现延时。
程序中定义了四个 LED 的引脚号,通过 `sbit` 关键字定义了 LED 引脚为 P1 口的相应引脚。然后使用一个无限循环,不断控制四个 LED 的灯光交替闪烁。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)