Left shift function _crol_(x,y) and array implementation
#include #include #define uint unsigned int #define uchar unsigned char uchar temp;/*The variable type and the assigned value should be consistent. Port P1 is an 8-bit register, so uchar*/ void delay(uint); void main() { temp=0XFE; P1=temp; while(1) { temp=_crol_(temp,1); //circular shift left delay(300); P1=temp; } } void delay(uint z) { uint x,y; for(x=100;x>0;x--) for(y=z;y>0;y--); } ``` // Array implementation ``` #include #include #define uint unsigned int #define uchar unsigned char uchar i; uchar table[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; void delay(uint z) { uint x,y; for(x=100;x>0;x--) for(y=z;y>0;y--); } void main() { while(1) { for(i=0;i<8;i++) { P1=table[i]; delay(300); } } }
Previous article:51 single chip microcomputer static digital tube display
Next article:"Beginner's C51 Self-study Notes" - Flowing Light Implementation (Bit Operation)
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Another technical solution for power-type plug-in hybrid: A brief discussion on Volvo T8 plug-in hybrid technology
- ADC Research of msp430F5438A
- Please help analyze how the following negative voltage is generated and the direction of current flow, thank you
- 15 yuan free shipping: high quality, Sensirion digital temperature and humidity sensor SHT31 (limited quantity, hurry up)
- How to detect motor speed?
- What are the maskable interrupts of MSP430_The priority of MSP430 interrupts
- Is this type of mask = medical surgical mask?
- Some Summary of Differential Mode and Common Mode
- TCP network communication problem
- Ask for help from all the senior experts!!
- Using Ginkgo USB-ADC and heart rate sensor to implement a heart rate tester with Android APP source code