내, 외부 인터럽트: 신호를 내는것이 내부냐 왜부냐에 따라 결정
벡터넘버: 인터럽트에 번호를 넣음(고유번호)
---------------------------------------------------------------------------
DK128 LED켜고 끄기
Main.c통합방식
#include(void)
#define DDRA (*((volatile unsigned char *)0x21))
#define PORTA (*((volatile unsigned char *)0x22))
#define PINA (*((volatile unsigned char *)0x20))
#define EIMSK (*((volatile unsigned char *)0x3D))
#define EICRA (*((volatile unsigned char *)0x69))
#define EICRB (*((volatile unsigned char *)0x6A))
#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" ::)
#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);
EIMSK = (1<<INT0);//
SREG = SREG|(1<<INT7);//sei();
while(1);
return 0;
}
void __vector_1(void)//이름안에 들어갈수 있는것은 언더바(_),알파벳(대 소문자),숫자
{
volatile unsigned int uiCnt;
for(uiCnt = 0; 30000>uiCnt ; ++uiCnt);
PORTA = ~PORTA;
}
나누어서 만들기(main.c와 main.h로 나눔)
main.c
#include<"main.h">
int main(void)
{
DDRA = 0XFF;
PORTA = 0X00;
EICRA = (3<<ISC0);
EIMSK = (1<<INT0);//
SREG = SREG|(1<<INT7);//sei();
while(1);
return 0;
}
void __vector_1(void)//이름안에 들어갈수 있는것은 언더바(_),알파벳(대 소문자),숫자/
{
volatile unsigned int uiCnt;
for(uiCnt = 0; 30000>uiCnt ; ++uiCnt);
PORTA = ~PORTA;
}
main.h
#ifndef __MAIN_H
#define __MAIN_H
#define DDRA (*((volatile unsigned char *)0x21))
#define PORTA (*((volatile unsigned char *)0x22))
#define PINA (*((volatile unsigned char *)0x20))
#define EIMSK (*((volatile unsigned char *)0x3D))
#define EICRA (*((volatile unsigned char *)0x69))
#define EICRB (*((volatile unsigned char *)0x6A))
#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" ::)
#define sleep() __asm__ __volatile__ ( "sleep" "\n\t" :: )
void __vector_1(void) __attribute__((signal, used, externally_visible));
#endif//__MAIN_H_
'코스웨어 > 16년 스마트컨트롤러' 카테고리의 다른 글
20160311_노유찬_펌웨어실습 (0) | 2016.03.16 |
---|---|
20160315_노유찬_펌웨어실습(LCD출력준비및전역변수) (0) | 2016.03.16 |
팀뷰어 보안 문제 있는거 같습니다... (0) | 2016.03.16 |
20160316-이보원-ATMega2560 -LCD 실험 2 (1) | 2016.03.16 |
LCD_Str (0) | 2016.03.16 |
20160316_업무일지_정우민_펌웨어실습(LCD) (0) | 2016.03.16 |
2016.03.11_노태경_업무일지 (0) | 2016.03.16 |
16.03.16 조승현 업무일지 about_LCD 디스플레이 명령어 (0) | 2016.03.16 |