Experiment name: External interrupt 1 Experiment
wiring description:
Experiment phenomenon: After downloading the program, pressing the K4 key can control the D1 indicator light to turn on and off.
Notes:
******************* *************************************************** ******************/
#include "reg52.h"
typedef unsigned int u16; //Redefine the system default data type
typedef unsigned char u8;
//Define LED1 pin
sbit LED1=P2^0;
//Define independent button K4 control pin
sbit KEY4=P3^3;
/****************************************************** ****************************
* Function name: delay_10us
* Function function: Delay function, when ten_us=1, the delay is approximately 10us
* Input: ten_us
* Output: None
**************************************** ***************************************/
void delay_10us(u16 ten_us)
{
while(ten_us --);
}
/****************************************************** ******************************
* Function name: exti1_init
* Function function: External interrupt 1 configuration function
* Input: None
* Output : none
************************************************ *****************************/
void exti1_init(void)
{
IT1=1;//Edge trigger mode ( Falling edge)
EX1=1;//Turn on the interrupt enablement of INT1
EA=1;//Turn on the total interrupt
}
/****************************************************** ******************************
* Function name: main
* Function function: main function
* Input: None
* Output: None
* *************************************************** ******************************/
void main()
{
exti1_init();//External interrupt 1 configuration
while(1)
{
}
}
void exti1() interrupt 2 //External interrupt 1 interrupt function
{
delay_10us(1000);//Destroy
if(KEY4==0)//Determine again whether the K4 key is pressed
LED1=!LED1;//LED1 status flip
}
Previous article:51 microcontroller learning: timer 0 experiment
Next article:51 microcontroller learning: external interrupt 0 experiment
Recommended posts
- zd test zd test 1
- eric_wang Analog electronics
- USB network port module test based on TI Sitara Cortex-A8
- USBnetworkportmoduletest TheUSBnetworkportmoduleusedinthiscaseisMicrochip'sEVB-LAN9500A-LC,whichcanbeusedtoexpandthenetworkportoftheevaluationboard.StarttheevaluationboardandconnecttheUSBnetworkportmodu
- Tronlong小分队 ARM Technology
- Technical Article: Reliable Power-Up and Power-Down Sequencing
- Today’selectronicapplicationsoftenrequiremorethanone5Vor3.3Vsupplyvoltage.Ten,20,ormorevoltagesarenotuncommon.Inaddition,therearevoltagedomainsthathavethesamevoltagelevelbutmustbegeneratedasseparatedomains—th
- okhxyyo Power technology
- Study the signal strength of the RF coil
- RFcoiltechnologyisubiquitousthroughouttheworldandisamajorcomponentoftechnologyrangingfrommedicaldevicestowirelessconnectivity.Itisimportanttoensurethatthecoilscontainedinthesedevicesareproperlytransmittinginforma
- btty038 RF/Wirelessly
- [National Technology Low Power Series N32L43x Review] 08. Software and Hardware I2C Driver 1.5-inch 16-color grayscale OLED display
- Overview TheNationalN32L43xseriesMCUhasa2-wayhardwareI2Cinterface,whichprovidesmulti-hostfunctionalityandcontrolsallI2Cbus-specifictiming,protocols,arbitration,andtiming.Itsupportsmultiplecommunicationmodes(upto1M
- xld0932 Domestic Chip Exchange
- Discussion on Deep Learning Frameworks
- Theopensourceecosystemisverycomplete.Well-knowndeeplearning-relatedopensourceframeworksincludecaffe,tensorflow,pytorch/caffe2,keras,mxnet,paddldpaddle,theano,cntk,deeplearning4j,matconvnet,etc.Inaddition,therearenichef
- ljg2np Programming Basics
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- Crystal oscillator problem
- Design of PLC communication between CAN bus and computer
- What are the introductory knowledge points for Web front-end?
- [TI's Big Live Broadcast] Let's get started! For 30 yuan, let's play with the new MSP430 that helps eliminate smog, vertical and horizontal sensing and measurement
- HardFault location method and steps for smart microcontroller
- Filter Design in Embedded Development
- How to reuse the same module in Allegro software?
- sad
- (2) Based on STM32L4R9 MEMS sensor board (IKS01A3): project creation and testing
- Huawei base station equipment disassembly-power supply part