Page 178 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 178

EI_RESISTOR();

                SREG|=0x80;


                SHOOT();

                  while(1)

                {
                    if(rx==0X00) {PORTA  =  0x00;}   //  LED  on

                    if(rx==0X01) {PORTA  =  0x01;}   //  LED  off
                    if(rx==0x02) SI5312();
                    if(shot==0)  BUZZER();

                    PORTB=shot;
                    if  (mag==1)  BUZZER();

                    if(rx==0x03){PORTD=0x00;PORTD=0b00100000;}        //모터
                    if(rx==0x04){PORTD=0x00;PORTD=0b00001000;}
                    if(rx==0x05){PORTD=0x00;PORTD=0b00101000;}

                    if(rx==0x06){PORTD=0x00;PORTD=0b01010000;}
                    if(rx==0x07){PORTD=0x00;PORTD=0b00000000;}

                }
            }



            interrupt  [USART0_RXC]  void  RX_interrupt (void)  //수신 시 인터럽트
            {

                rx=UDR0;
            }



            interrupt  [EXT_INT0]void gun (void)  //적외선  센서
            {

                shot--;            //적외선 총에  맞으면 생명  감소
                PORTB=shot;
                delay_ms(1);

                BTshot=0x30+shot;



                delay_ms(1000);    //한 번에  한  발만  맞음




                                                         -  171  -
   173   174   175   176   177   178   179   180   181   182   183