BASIC4MCU | 질문게시판 | atmega128 토글 스위치 인터럽트로 led 점등
페이지 정보
작성자 소리왕 작성일2020-10-08 16:59 조회8,705회 댓글2건
https://www.basic4mcu.com/bbs/board.php?bo_table=gac&wr_id=13472
작성일
본문
스위치1으로만 인터럽트 사용해서 led 껏다 켰다 하고싶은데
#include <avr/io.h>
#include <avr/interrupt.h>
#define F_CPU 16000000UL
#include <util/delay.h>
ISR(INT4_vect)
{
PORTA = 0xff;
}
int main(void)
{
DDRA =0xff;
DDRE = 0x00;
EICRB = 0x02; // 0000 0010
EIMSK = 0x10; // 0010 0000
sei();
while(1)
{
}
}
어디를 수정해야할까요?
댓글 2
조회수 8,705master님의 댓글
master 작성일PORTA ^= 0xff; // 출력 토글(반전)
소리왕님의 댓글
소리왕
감사합니다!!