Page 1140 - 3-3
P. 1140

TCNT3H=0;
              TCNT3L=0;
              #asm("sei")
          }


          interrupt [EXT_INT0] void ext_int0_isr(void)
          {
              #asm("cli")
              switch(ir_state)
              {
                  //  인터럽트 걸리기 전의 상태라면
                  case 0:
                      //  하강에지 검출 상태로 변경
                      ir_state=1;
                      break;
                  //  처음 하강에지 검출 상태
                  case 1:
                      // 하강 에지간 8.5ms~9.5ms      간격이 있다면 데이터 저장상태로 변경
                      if((85<=ir_timer_cnt)&&(ir_timer_cnt<95))ir_state=2;
                      ir_bit_cnt=0;
                      ir_rx_temp=0;
                      if(ir_rx_flag>3)
                      {
                          ir_rx_flag=0;
                          ir_value='g';
                      }
                      break;
                  //  비트를 분석해 4     바이트(32   비트 를 저장하는 상태)
                  case 2 :
                      // 0.9ms~1.3ms  사이면 0     수신
                      if((9<=ir_timer_cnt)&&(ir_timer_cnt<13)){


                      }
                      // 1.9ms~2.5ms  사이면 1     수신
                      else if((19<=ir_timer_cnt)&&(ir_timer_cnt<25))
                      {
                          ir_rx_temp|=0x80;
                      }
                      else
                      {
                          ir_state=1;
                          break;
                      }
                      ir_bit_cnt++;
                      if((ir_bit_cnt%8)==0){


                                                        - 1140 -
   1135   1136   1137   1138   1139   1140   1141   1142   1143   1144   1145