80C31 MCU external interrupt 0

Publisher:快乐之源Latest update time:2024-08-15 Source: elecfansKeywords:80C31 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

/*

External interrupt 0 interrupt, the effect is that the lower four bits are lit, and the upper four bits are lit when the interrupt occurs.

After the interruption, the program returns to the main program and continues to light up the lower four bits.

*/

#include

#include


//To interrupt, you need to set some parameters

void center1()

{

EX0 = 1; //Interrupt enable switch

IT0 = 0; // Falling edge trigger mode

EA = 1; // Main switch

}

void main(void) //Main function

{

zhongduan1();

//Low level lights up

while(1) //Large loop

{

P0 = 0xf0; //light up the lower four bits 1111 0000

}

}

//Now create an interrupt, when the interrupt occurs, the high four bits are lit

void zhongduan() interrupt 0

{

P0 = ~0xf0; //The content to be executed after the interrupt occurs is the high four bits are lit

}


Keywords:80C31 Reference address:80C31 MCU external interrupt 0

Previous article:Timer/Counter 0 (Counter)
Next article:LCD with character display I LOVE YOU

Latest Microcontroller Articles
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号