Page 150 - MDP2022-3
P. 150

Cy_GPIO_Write(pMotorRightB_PORT,  pMotorRightB_NUM,  0);
                            }
                    }


                    else  if(flag  ==  1){//stop

                    }
            }



            int  main(void)
            {
                    __enable_irq();  /*  Enable  global  interrupts.  */


                    /*  Place  your  initialization/startup  code  here  (e.g.  MyInst_Start())  */
                    mUART_Start();


                    mUART_HW->INTR_RX_MASK  =  SCB_INTR_RX_MASK_NOT_EMPTY_Msk;
                    Cy_SysInt_Init(&mUART_SCB_IRQ_cfg,  mUARTHandler);
                    NVIC_EnableIRQ(mUART_SCB_IRQ_cfg.intrSrc);


                    for(;;)
                    {
                            unsigned  char  ch  =  getReceive();
                            moveMotor(ch);
                    }

            }


            /*  []  END  OF  FILE  */



            #  Atmega128  코드
            #include  <mega128.h>
            #include  <delay.h>


            void  main()
              {

                    TCCR1A=0x82;
                    TCCR1B=0x1b;
                    ICR1=4999;
                    OCR1A=375;

                    DDRB|=0x20;
                    PORTB|=0x20;
   145   146   147   148   149   150   151   152   153   154   155