Guest Book

Leave your greetings here

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

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

  2. 치환 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.***.***

  3. ss 2008/12/04 17:14 M/D Reply Permalink

    /* LED: PORTTF사용 PIN 54-61*/
    #define PORT_LED PORTF
    #define DDR_LED DDRF
    #define PIN_LED PINF


    /* FND: PORTC사용 PIN 35-42*/
    #define PORT_FND PORTC
    #define DDR_FND DDRC
    #define PIN_FND PINC

    /* KEY:PORTA사용 PIN 51~44 */
    #define PORT_KEY PORTA
    #define DDR_KEY DDRA
    #define PIN_KEY PINA // 219.252.***.***

  4. 박태성 2008/09/09 18:27 M/D Reply Permalink

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

    void init(void);

    int main(void){
    init(); // 포트 기타등등 초기화와 설정
    sei(); // set enable interrupt
    for ( ; ; )
    {
    } // 서비스 루틴
    return 1;
    }
    void init(){
    DDRF=0xFF; // DDRF Ports Output
    PORTF=0x55;
    DDRE=0<<INT0|0<<INT4; // DDRE


    // 인터럽트 해당하는 부분
    EIFR=0x00;
    EIMSK=(1<<INT0|1<<INT4);
    EICRA=EICRA|(1<<ISC01|0<<ISC00);
    EICRB=EICRB|(1<<ISC41|1<<ISC41);

    }
    SIGNAL(SIG_INTERRUPT0){
    PORTF=0x0F;
    }
    SIGNAL(SIG_INTERRUPT4){
    PORTF=0xF0;
    }

    // 219.252.***.***

    1. rCan 2008/09/10 21:48 M/D Permalink

      수정..

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

      void init(void);

      int main(void){
      init(); // 포트 기타등등 초기화와 설정
      sei(); // set enable interrupt
      for ( ; ; )
      {
      } // 서비스 루틴
      return 1;
      }
      void init(){
      DDRF=0xFF; // DDRF Ports Output
      PORTF=0x55;
      DDRE=0<<INT0|0<<INT4; // DDRE


      // 인터럽트 해당하는 부분
      EIFR=0x00;
      EIMSK=(1<<INT0|1<<INT4);
      EICRA=EICRA|(1<<ISC01|0<<ISC00);
      EICRB=EICRB|(1<<ISC41|1<<ISC40);

      }
      SIGNAL(SIG_INTERRUPT0){
      PORTF=~PORTF;
      }
      SIGNAL(SIG_INTERRUPT4){
      PORTF=0xF0;
      } // 124.63.***.***

  5. 강민수 2008/07/10 13:57 M/D Reply Permalink

    안녕하십니까~~ ^-^

    지나가다 들렸습니다.. 꾸벅~ // 222.112.***.***

  6. siroiki 2008/05/27 15:51 M/D Reply Permalink

    안녕하셈 ' ㅅ ' // 210.91.***.***

    1. rCan 2008/05/29 11:45 M/D Permalink

      안녕하세염 ^_^ ㅋㄷㅋㄷ // 219.252.***.***

« Previous : 1 : 2 : 3 : 4 : 5 : ... 42 : 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:
89819
Today:
15
Yesterday:
57