마프-결과보고서-Polling과 Interrupt 방식으로 스위치 제어하기
- 최초 등록일
- 2015.07.27
- 최종 저작일
- 2015.04
- 14페이지/ MS 워드
- 가격 2,000원
목차
1. Introduction
2. Process
3. Discussion
4. Result
5. Conclusion
본문내용
1. Introduction
실습 내용 및 목표 정리
Polling과 interrupt 방식으로 스위치를 제어하는 것이 이번 실습의 목표
2. Process
실습 순서 및 실습 내용
1. Polling 방식으로 스위치 입력을 받아들여 LED 이동
#include <avr/io.h>
#include <util/delay.h>
#define DEBOUNCING_DELAY 20
void msec_delay(int n);
unsigned int pattern[8] = {0xFE, 0xFD, 0xFB, 0xF7, 0xEF, 0xDF, 0xBF, 0x7F};
int main()
{
int i=0;
DDRA = 0xFF;
DDRE = 0x00;
PORTA = pattern[i];
<중 략>
Polling 방식으로 스위치 1은 왼쪽, 스위치 2는 오른쪽으로 LED 이동
#include <avr/io.h>
#include <util/delay.h>
#define DEBOUNCING_DELAY 20
void msec_delay(int n);
unsigned int pattern[8] = {0xFE, 0xFD, 0xFB, 0xF7, 0xEF, 0xDF, 0xBF, 0x7F};
<중 략>
Interrupt 방식으로 스위치 1은 왼쪽, 스위치 2는 오른쪽으로 LED 이동
#include<avr/io.h>
#include<avr/interrupt.h>
#include<util/delay.h>
#define DEBOUNCING_DELAY 20
void msec_delay(int n);
static volatile int index = 0;
static unsigned char pattern[8]
={0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
참고 자료
없음