-- 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

