INTRINS.H in C51

Publisher:GoldenDreamLatest update time:2024-07-31 Source: cnblogsKeywords:C51  INTRINS Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

INTRINS.H: Internal functions
Function name: _crol_, _irol_, _lrol_
Prototype: unsigned char _crol_(unsigned char val,unsigned char n);
unsigned int _irol_(unsigned int val,unsigned char n);
unsigned int _lrol_(unsigned int val,unsigned char n);
Function: _crol_, _irol_, _lrol_ shift val left by n bits in bitwise form. This function
is related to the 8051 "RLA" instruction The above functions are different from the parameter type.
Example:
#include
main()
{
unsigned int y;
C-5 1 Programming 37
y=0x00ff;
y=_irol_(y,4); /*y=0x0ff0*/
}
Function name: _cror_, _iror_, _lror_
Prototype: unsigned char _cror_(unsigned char val,unsigned char n);
unsigned int _iror_(unsigned int val,unsigned char n);
unsigned int _lror_(unsigned int val,unsigned char n);
Function: _cror_, _iror_, _lror_ shift val right by n bits in bitwise form. This function
is related to the 8051 "RRA" instruction. The above functions are different from the parameter type.
Example:
#include
main()
{
unsigned int y;
y=0x0ff00;
y=_iror_(y,4); /*y=0x0ff0*/
}
Function name: _nop_
Prototype: void _nop_(void);
Function: _nop_ generates a NOP instruction, which can be used for time comparison in C programs. The C51 compiler does not generate a function call during the operation of the _nop_
function
, that is, the NOP instruction is directly executed in the program.
Example:
P()=1;
_nop_();
P()=0;
Function name: _testbit_
Prototype: bit _testbit_(bit x);
Function: _testbit_ generates a JBC instruction, which tests a bit and returns 1 when it is set, otherwise it returns 0.
If the bit is set to 1, the bit is reset to 0. The JBC instruction of 8051 is used for this purpose.
_testbit_ can only be used on directly addressable bits; its use in expressions is not allowed.

2008-02-19 08:56

_crol_ Character Rotate
Left_cror_ Character Rotate Right_irol_
Integer Rotate
Left_iror_ Integer Rotate Right_lrol_
Long Integer Rotate
Left_lror_ Long Integer Rotate Right_nop_
No Operation 8051 NOP
Instruction_testbit_ Test and Clear Bit 8051 JBC Instruction

Detailed explanation:

Function name: _crol_, _irol_, _lrol_
Prototype: unsigned char _crol_(unsigned char val,unsigned char n);
unsigned int _irol_(unsigned int val,unsigned char n);
unsigned int _lrol_(unsigned int val,unsigned char n);
Function: _crol_, _irol_, _lrol_ shift val left by n bits in bitwise form. This function
is related to the 8051 "RLA" instruction. The above functions are different from the parameter type.
Example:
#include
main()
{
unsigned int y;
C-5 1 Programming 37
y=0x00ff;
y=_irol_(y,4); /*y=0x0ff0*/
}

Function name: _cror_, _iror_, _lror_
Prototype: unsigned char _cror_(unsigned char val,unsigned char n);
unsigned int _iror_(unsigned int val,unsigned char n);
unsigned int _lror_(unsigned int val,unsigned char n);
Function: _cror_, _iror_, _lror_ shift val right by n bits in bitwise form. This function
is related to the 8051 "RRA" instruction. The above functions are different from the parameter type.
Example:
#include
main()
{
unsigned int y;
y=0x0ff00;
y=_iror_(y,4); /*y=0x0ff0*/
}

Function name: _nop_
Prototype: void _nop_(void);
Function: _nop_ generates a NOP instruction. This function can be used for time comparison in C programs. The C51 compiler
does not generate a function call during the operation of the _nop_ function, that is, the NOP instruction is directly executed in the program.
Example:
P()=1;
_nop_();
P()=0;

Function name: _testbit_
Prototype: bit _testbit_(bit x);
Function: _testbit_ generates a JBC instruction that tests a bit and returns 1 if it is set, otherwise it returns 0.
If the bit is set to 1, it resets the bit to 0. The 8051 JBC instruction is used for this purpose.
_testbit_ can only be used for directly addressable bits; it is not allowed to be used in expressions.


Keywords:C51  INTRINS Reference address:INTRINS.H in C51

Previous article:Embedded C Programming Tutorial Using Keil Language (Part 2)
Next article:MCU Special Function Register (SFR)

Recommended ReadingLatest update time:2024-11-16 09:38

Analysis of WT2003H4-16S voice chip key recording and playback application
With the increasing demand and rapid development of voice interaction in smart electronic products, voice chips have been deeply used in all walks of life. How to give vitality to electronic products, so that they can play their own functions and realize voice interaction. Product intelligent voice involves home app
[Embedded]
Analysis of WT2003H4-16S voice chip key recording and playback application
Yuntu officially released the high-end domain control chip YTM32B1H, making strong progress in functional safety ASIL-D automotive grade chips
On August 8, 2023, Suzhou Yuntu Semiconductor Co., Ltd. (hereinafter referred to as "Yuntu Semiconductor") released the latest generation domain controller chip YTM32B1H series, covering automotive power, intelligent chassis, functional safety controllers, domain controllers, etc. In terms of application areas, sample
[Automotive Electronics]
Yuntu officially released the high-end domain control chip YTM32B1H, making strong progress in functional safety ASIL-D automotive grade chips
H1 revenue exceeded 200 billion, and Foxconn Industrial Internet accelerated the creation of the "second growth pole"
On the evening of August 9, Foxconn Industrial Internet released its 2022 semi-annual report. The report shows that in the first half of 2022, Foxconn Industrial Internet's operating income reached 225.26 billion yuan, an increase of 14.91% over the same period last
[robot]
C51-Timer/Counter
The timer and counter themselves use the same physical device, but are converted due to their different operating modes.
[Microcontroller]
C51-Timer/Counter
Design of STC8H8K64U microcontroller compatible with STC89C52 development board
This article uses the STC8H8K64U microcontroller to be compatible with the STC89C52 traditional development board and design the core board to maximize pin resource allocation. Combined with the graphical programming language compatible with Keil C, it explains the software and hardware development and application of
[Microcontroller]
Design of STC8H8K64U microcontroller compatible with STC89C52 development board
In-depth introduction to the use steps and precautions of JCF-6H dust detector
In the last issue of "Juchuang Science and Technology", we introduced the JCF-5H dust monitor. The editor introduced the characteristics and applicable scope of this universal dust monitor in detail, and showed you detailed pictures of the instrument. However, some friends still have questions about this instrument. T
[Test Measurement]
In-depth introduction to the use steps and precautions of JCF-6H dust detector
With the release of H.266 standard, how long will it take for 4K/8K to become popular in the security industry?
The advent of the ultra-high-definition video era not only brings us a better viewing experience, but also puts higher demands on video encoding technology. However, current mainstream video encoding technologies such as H.264 and H.265 have difficulty compressing the video to a certain size for easy transmission whil
[Mobile phone portable]
Usage of interrupt and using in C51 - microcontroller
void INT0()interrupt 0 using 1 {.... ..... } interrupt 0 indicates external interrupt 0; interrupt 1 indicates timer interrupt 0;  interrupt 2 indicates external interrupt 1; interrupt 3 indicates timer interrupt 1; interrupt 4 indicates a serial port interrupt; using 0 is the 0th group of registers; using 1 is the f
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号