프로그램/마이컴

외부 인터럽트

더월드 2020. 3. 4.
#include<reg51.h>
#define LEDs P0
unsigned char count=0;

void ext_int_0 () interrupt 0 
{ 
    count++;
}
 
void ext_int_1 () interrupt 2 
{ 
   count--;
}

void main()
{
   P3 |= 0x0c; // Configure the INT0 & INT1 pins as Inputs
   EX0 = 1;    // Enable INT0
   EX1 = 1;    // Enable INT1
   EA  = 1;    // Enable Global Interrupt bit
   
   while(1)
   {
     LEDs = count;
   }
}

'프로그램 > 마이컴' 카테고리의 다른 글

PIC18F4520 Timer.  (0) 2020.03.04
8051 모든 인터럽트  (0) 2020.03.04
8051/4051 Timers  (0) 2020.03.04
8051/4051 UART Interrupt  (0) 2020.03.03
8051/4051 UART  (0) 2020.03.03

댓글

💲 추천 글