본문 바로가기
코스웨어/16년 스마트컨트롤러

인터럽트

by 알 수 없는 사용자 2016. 3. 14.
728x90
반응형

#define  DDRA   (*((volatile unsigned char *)0x21))


#define  PORTA  (*((volatile unsigned char *)0x22))


#define  PINA   (*((volatile unsigned char *)0x20))


#define  EICRA   (*((volatile unsigned char *)0x69))


#define  EIMSK   (*((volatile unsigned char *)0x3D))


#define  SREG   (*((volatile unsigned char *)0x5F))


#define INT7 7    

#define  INT6 6

#define  INT5 5

#define  INT4 4

#define  INT3 3

#define  INT2 2

#define  INT1 1 

#define  INT0 0 


#define  ISC7 6

#define  ISC6 4

#define  ISC5 2

#define  ISC4 0

#define  ISC3 6

#define  ISC2 4

#define  ISC1 2 

#define  ISC0 0


#define sei()   __asm__ __volatile__ ("sei" ::)

//어셈블리 명령어로써 특정7번만 불러옴

#define sleep()  __asm__ __volatile__ ( "sleep" "\n\t" :: )




void __vector_1 (void) __attribute__((signal, used, externally_visible));



int main(void)

{

DDRA  = 0xFF;

PORTA = 0x00;

EICRA = (3<<ISC0); //상승인자 ISC0 = INT0 (20<<ISC2)|(3<<ISC0);INT2=ISC2

EIMSK = (1<<INT0); //<인터럽트 0의 문을염 3번을 열어야하면 1<<INT3

SREG  = SREG|(1<<INT7); // = sei();

sleep();

while(1)

{

}

return 0;

}

void __vector_1 (void)

{

PORTA = ~PORTA;//~ 이게 필드임필드

}

728x90