« Previous : 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : ... 44 : Next »

[ATMEGA128] 인터럽트 타이머 장난(?)

/*
처음은 불이 꺼진상태
PORTF=0xFF;
인터럽트4가 들어오면 불이 다 켜지게
인터럽트7이 들어오면 500ms LED반전
*/

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

#define OVERFLOW 256
#define CPU_CLOCK 16000000
#define TICKS_PER_SEC 1000
#define Prescaler 64

volatile unsigned int tic_time;

void init_int(void);
void init_timerCounter(void);

int main(void){
        init_timerCounter();
        init_int();
        sei(); // set enable interrupt
        for(;;){
                if(tic_time==500){
                        tic_time=0;     // tic_time 초기화
                        PORTF=~PORTF;   //200ms PORTF 상태 반전
                }
        }
        return 1;
}

void init_int(){
        cbi(DDRE,4);
        cbi(DDRE,5);
        cbi(DDRE,7);

        EIFR=0x00;
        EICRB=0x8A;
        EIMSK=0xB0;
}

void init_timerCounter(){
// 초기화 작업
        DDRF=0xFF;      // DDRF 방향 설정
        PORTF=0xFF;     // PORTF LED 초기화
        TIFR=0x00;
        TCCR0=0x04;     // Prescaler 설정
        TCNT0= OVERFLOW - (CPU_CLOCK / TICKS_PER_SEC / Prescaler);      // 오버플로우에 사용될 초기값
//        TIMSK=0x01;     // 오버플로우 인터럽트 허용
        TIMSK=0x00; // 임시적으로 인터럽트 불가
}

SIGNAL(SIG_INTERRUPT4){
        PORTF=0x00;
}
SIGNAL(SIG_INTERRUPT5){
        TIMSK=0x00;
        PORTF=0xFF;
}
SIGNAL(SIG_INTERRUPT7){
        TIMSK=0x01; // 오버플로우 인터럽트 허용
}

SIGNAL(SIG_OVERFLOW0){
 tic_time++; // 1000ms마다 생기는 오버 플로우를 카운팅함.
 TCNT0 = OVERFLOW - (CPU_CLOCK / TICKS_PER_SEC / Prescaler);    // 오버 플로우 한후에 TCNT0값을 초기화 시켜줌.
}

Posted by rCan

2008/09/16 17:44 2008/09/16 17:44
Response
No Trackback , No Comment
RSS :
http://rcan.net/rss/response/564

카히미 카리에의 묘한 매력(?)



'') - 출처  : http://blog.naver.com/lkhlcj20/140027094521

DMC라는 애니메이션을 보게된 이후로 듣게된(?) 뭐 이런...
카히미 카리에는 조금 오래전부터 이름만 듣고 있었다.

같이 겜하던 사람의 캐릭명이라서 처음에는 누군지도 무엇인지도 몰랐...
그러다가 DMC라는 애니메이션에서 주인공남자가 좋아하는 뮤지션으로
카히미 카리에가 .... 그래서 검색해보았다..... 카히미 카리에.. 두둥...

처음들은 곡은...  The Symphonies Of Beethoven
뭐랄까..  들으면 들을수록 좋아진다는 느낌같은걸....
뭔가 계속 빠져들어간다는 느낌....






Posted by rCan

2008/09/16 11:24 2008/09/16 11:24
Response
No Trackback , No Comment
RSS :
http://rcan.net/rss/response/563


[ATMega128] 타이머/카운터

200ms마다 LED상태를 반전 시키는 코드
두가지 방법으로 overflow 방법과 ocm방식으로 코딩을..
실제적인 테스트는 아직이라서 확실하진 않지만.

// Timer/Counter Overflow

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

#define OVERFLOW 256
#define CPU_CLOCK 16000000
#define TICKS_PER_SEC 1000
#define Prescaler 64

volatile unsigned int tic_time;

void init(void);

int main(void){
        init();
        sei(); // set enable interrupt
        for(;;){
                if(tic_time==200){
                        tic_time=0;     // tic_time 초기화
                        PORTF=~PORTF;   //200ms PORTF 상태 반전
                }
        }
        return 1;
}

void init(){
// 초기화 작업
        DDRF=0xFF;      // DDRF 방향 설정
        PORTF=0xFF;     // PORTF LED 초기화
        TCCR0=0x04;     // Prescaler 설정
        TCNT0= OVERFLOW - (CPU_CLOCK / TICKS_PER_SEC / Prescaler);      // 오버플로우에 사용될 초기값
        TIMSK=0x01;     // 오버플로우 인터럽트 허용
}

SIGNAL(SIG_OVERFLOW0){
 tic_time++; // 1000ms마다 생기는 오버 플로우를 카운팅함.
 TCNT0 = OVERFLOW - (CPU_CLOCK / TICKS_PER_SEC / Prescaler);    // 오버 플로우 한후에 TCNT0값을 초기화 시켜줌.
}

// Timer/Counter Output Compare Match

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

#define CPU_CLOCK 16000000
#define TICKS_PER_SEC 1000
#define Prescaler 64

volatile unsigned int tic_time;

void init(void);

int main(void){
        init();
        sei(); // set enable interrupt
        for(;;){
                if(tic_time==200){
                        tic_time=0;     // tic_time 초기화
                        PORTF=~PORTF;   // PORTF상태 반전
                }
        }
        return 1;
}

void init(){
        DDRF=0xFF;      // DDRF 방향 설정
        PORTF=0xFF;     // PORTF LED 초기화
        TCCR0=0x1C;     // Prescaler 설정과 OC0 토글 사용
        TIMSK=0x02;     // OCM으로 설정
        TCNT0 = 0;      // TCNT0 0으로 초기화
        OCR0 = CPU_CLOCK / TICKS_PER_SEC / Prescaler - 1;
}

SIGNAL(SIG_OUTPUT_COMPARE0){
 tic_time++;
}


Posted by rCan

2008/09/10 21:45 2008/09/10 21:45
Response
No Trackback , No Comment
RSS :
http://rcan.net/rss/response/560

[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

WIPI Eclipse 설정

컴파일
① Location : C:\j2sdk1.4.2_17\bin\javac.exe
② Working Directory : ${workspace_loc:/${project_name}/src}
③ Arguments : -bootclasspath C:\AromaWIPI\JavaAppDemo\lib\classes.zip ${resource_name}

JAR 만들기
① Location : C:\j2sdk1.4.2_17\bin\jar.exe
② Working Directory : ${workspace_loc:/${project_name}/bin}
③ Arguments : -cvf ${java_type_name}.jar *.class *.gif *.png *.bmp *.mid *.mmf

에뮬레이터실행
① Location : C:\AromaWIPI\Emulator\WIPIEmul.exe
② Working Directory : C:\AromaWIPI\Emulator
③ Arguments : -HEAPSIZE=1024 -classpath "${workspace_loc:/${project_name}/bin}\${java_type_name}.jar" org.kwis.msp.lcdui.Main ${java_type_name}

Posted by rCan

2008/09/08 10:29 2008/09/08 10:29
Response
No Trackback , No Comment
RSS :
http://rcan.net/rss/response/557

슬램덩크.... 오프닝 엔딩




출처 : http://blog.naver.com/baqoo0oo

Posted by rCan

2008/08/14 16:46 2008/08/14 16:46
Response
No Trackback , No Comment
RSS :
http://rcan.net/rss/response/555

내가 좋아했던 그룹 [ 영턱스클럽 ]

후우. 벌써 10년이 지나버린 그룹이지만
케이블보다 불후의명곡 SES편을 잠시 보게 되서 갑자기 생각나서.. 혹시나해서..
유투브에 검색해봤더니 후후.. 있네 흐흐흐






위에서부터 정 > 못난이컴플렉스 > 타인 뮤비
출처 : 유투브

Posted by rCan

2008/07/16 19:48 2008/07/16 19:48
Response
No Trackback , a comment
RSS :
http://rcan.net/rss/response/553

럭키스타 오프닝 (한국어판?!)


한국어버젼.... 멋지네요..

** 출처 : http://blog.daum.net/doobdoob/6747805

Posted by rCan

2008/05/29 11:44 2008/05/29 11:44
Response
No Trackback , No Comment
RSS :
http://rcan.net/rss/response/548

다행이다..



출처 : youtube.com

Posted by rCan

2008/04/22 10:37 2008/04/22 10:37
Response
No Trackback , No Comment
RSS :
http://rcan.net/rss/response/546

« Previous : 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : ... 44 : Next »

블로그 이미지

- rCan

Calendar

«   2010/09   »
      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    

Notices

  1. About Me

Recent Posts

Site Stats

Total hits:
89710
Today:
20
Yesterday:
42