[ATMega128] 인터럽트 관련내용

-- test1.h --
#include<avr/io.h>
#include<avr/interrupt.h>
#include<avr/signal.h>

-- test1.c --
#include "test1.h"

void init(void);

int main(void){
        init(); // 포트 기타등등 초기화와 설정
        sei(); // set enable interrupt
        for(;;){} // 서비스 루틴
        return 1;
}
void init(){
        DDRF=0xFF; // DDRF Ports Output
        PORTF=0x00;
        DDRE=0<<INT4|0<<INT5; // DDRE

//      cbi 클리어비트
//      cbi(DDRE,7); 사용법
//      sbi 셋 비트
//      sbi(DDRE,7); 사용법


        // 인터럽트 해당하는 부분
        EIFR=0x00;
        EICRB=EICRB|(1<<ISC41|0<<ISC40|1<<ISC51|0<<ISC51);
        EIMSK=EIMSK|(1<<INT4|1<<INT5);

}
SIGNAL(SIG_INTERRUPT4){
        PORTF=0xFF;
}
SIGNAL(SIG_INTERRUPT5){
        PORTF=0x00;
}

Posted by rCan

2008/09/09 17:49 2008/09/09 17:49
Response
No Trackback , No Comment
RSS :
http://rcan.net/rss/response/558

Trackback URL : http://rcan.net/trackback/558

Leave a comment
« Previous : 1 : ... 41 : 42 : 43 : 44 : 45 : 46 : 47 : 48 : 49 : ... 441 : Next »

블로그 이미지

- rCan

Calendar

«   2012/05   »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Notices

  1. About Me

Site Stats

Total hits:
118621
Today:
48
Yesterday:
120