Guest Book

Leave your greetings here

  1. 비밀방문자 2011/11/21 15:09 M/D Reply Permalink

    관리자만 볼 수 있는 방명록입니다. // 121.172.***.***

  2. k 2011/03/23 16:23 M/D Reply Permalink

    관리자만 볼 수 있는 방명록입니다. // 175.215.***.***

  3. 비밀방문자 2011/03/17 12:52 M/D Reply Permalink

    관리자만 볼 수 있는 방명록입니다. // 61.74.***.***

  4. 비밀방문자 2010/11/05 19:04 M/D Reply Permalink

    관리자만 볼 수 있는 방명록입니다. // 183.101.***.***

  5. 국민 2010/04/12 09:22 M/D Reply Permalink

    내가 누군지 아시는가요!!
    ㅋㅋㅋㅋㅋㅋㅋㅋ // 183.101.***.***

  6. 치환 2008/12/04 20:02 M/D Reply Permalink

    포트 바꿨는데 잘 안되서 키스캔 부분 수정 부탁드립니다.

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

    /* global variables*/
    volatile unsigned int check;//랜덤으로 불이 들어온것 저장 변수
    volatile unsigned int tic_time;
    volatile unsigned int cnt;//FND값 증가

    volatile unsigned char led_flag;
    volatile unsigned int cu_key;
    volatile unsigned int la_key;
    volatile unsigned int input_key;
    volatile unsigned int key_state_flag;
    volatile unsigned int key_cnt;
    volatile unsigned char key_input_check_flag;
    volatile unsigned char key_input_mode_flag;

    void init_port(void){
    /* 초기화!!initialize PORTF PORTC*/
    DDRF=0xFF;//LED포트를 출력 모드로 설정
    PORTF=0xFF;//LED 포트 초기화
    DDRD=0xFF;//FND 포트를 출력 모드로 설정
    PORTD=0x00;//FND 포트 초기화
    DDRC=0x00;//key 포트를 입력모드로 설정
    }
    void init_timer0(void)
    {
    TIFR=0x00;
    TCCR0=0x0C;
    sbi(TIMSK,1);
    TCNT0=0x00;
    OCR0=0xF9;
    }
    void init_timer3(void)
    {
    TIFR=0x00;
    ETIMSK=0x00;
    TCCR3A=0x00;
    TCCR3B=0x0C; // 00001100 256분주 couput compare사용
    TCCR3C=0x00;

    sbi(ETIMSK,4); //0001 0000 output_compare
    TCNT3H=0x00;
    TCNT3L=0x00;
    OCR3AH=0xF4;
    OCR3AL=0x24;
    }
    SIGNAL(SIG_OUTPUT_COMPARE0)
    {
    tic_time++;
    key_cnt++;
    }
    SIGNAL(SIG_OUTPUT_COMPARE3A)
    {
    if(led_flag==0)
    {
    check=(rand()%8);
    PORTF=~(1<<check);
    }
    }
    /*delay function*/

    /*main*/
    int main(void){
    init_port();
    init_timer0();
    init_timer3();
    /*PORT_LED=0x00;//0:불0, 1:불x
    tic_time=0;
    while(1000>tic_time){
    PORT_FND=0;}*/
    sei();
    while(1){//랜덤으로 불이 들어오게 해준다
    if(key_input_check_flag)
    {
    if(input_key!=0xFF)
    {
    if(input_key==check)
    {
    cnt++;
    PORTD=((cnt/10)<<4)|(cnt%10);

    }
    }
    }
    if(key_input_mode_flag)
    {
    cu_key=PINC;
    if(cu_key!=0xFF)
    {
    if(cu_key!=la_key)
    {
    key_cnt=0;
    key_state_flag=1;
    }
    if(key_cnt>=50)
    {
    if(key_state_flag==1)
    {
    key_state_flag=0;
    input_key=cu_key;
    }
    else
    {
    input_key=0xFF;
    }
    }
    }
    else
    {
    input_key=0xFF;
    }
    la_key=cu_key;
    }



    }//for(;;)
    return 1;
    } // 219.252.***.***

« Previous : 1 : 2 : 3 : 4 : 5 : ... 43 : Next »

블로그 이미지

- rCan

Calendar

«   2012/02   »
      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      

Notices

  1. About Me

Site Stats

Total hits:
113493
Today:
13
Yesterday:
37