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.
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
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- Modern Robust Control (Wu Min, Gui Weihua, He Yong)
- How to read electrical control circuit diagrams (Classic best-selling books on electronics and electrical engineering) (Zheng Fengyi)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- LPS27HHTW MEMS Pressure Sensor
- Are lead-free HASL and lead-free solder the same thing?
- CC2640R2F ADC
- Summary of the use of polarity and phase of MSP430 SPI
- How Designers Achieve Tri-Band Gigabit Speeds and High Throughput in Wi-Fi
- 【Development Kit for nRF52840】+ Evaluation of four Bluetooth serial port transparent transmission
- TMS320VC5502+ISP1581 USB2.0 high-speed data acquisition solution
- CH549EVT development board test - SPI test
- Find an IC IG00151 with pictures
- Designing with MSP430 MCU and Segment LCD