1 2 3 4 5 6 Previous Next 84 Replies Latest reply on Feb 22, 2013 7:07 AM by riko.husin Go to original post
      • 75. Re: Simple PWM
        riko.husin

        I started already,

           

         

           

        Don't worry too much with the comment, it's only a dummy project

           

        void GenerateCenterPosition( void ) {                /* Divide by eight function */
            PWM8_1_Stop();
            PWM8_1_WritePulseWidth( 100 );                    /* set pulse width to generate a 50% duty cycle */
            PWM8_1_Start();
        }

        • 76. Re: Simple PWM
          ki.leung

          Sorry, I missed that.

             

          Did you try change the DCset() vlaue betwen 10 and 20? for ie 10 is the left, 15 is the middle, and 20 is the right positiom.

          • 77. Re: Simple PWM
            riko.husin

            Mate,

               

            There's no response, servo is stall, just like video I have shown you guys

            • 78. Re: Simple PWM
              riko.husin

              I tried to imitate the function :

                 

               

                 

              void rotate()
              {
                   unsigned int i,count;                                 /* Delay10msTimes var */
                    unsigned char j;                                   /* LED var */
               
              count=10;
                           //rotate left every 45 degree begin
                                   for(i=0;i<50;i++)  // 10 equal to 5 degree
                                      {
                                          P0_0(1);
                                          Delay10msTimes(count);         
                                          P0_0(0);
                                          Delay10msTimes(100);
                                          //timer(70);
                                      }
                                  Delay10msTimes(200);   
                           for(i=0;i<50;i++)
                                      {
                                          P0_0(0);
                                          Delay10msTimes(count);         
                                          P0_0(1);
                                          Delay10msTimes(100);
                                          //timer(70);
                                          //timer(70);
                                      }
                                        Delay10msTimes(200);   

              }

                 

               

                 

              but I can't see my LED blinks, anyone knows why ?

                 

              thanks

              • 79. Re: Simple PWM
                riko.husin

                how can I do 90 and -90 degree ?

                   

                thanks

                • 80. Re: Simple PWM
                  user_14586677

                  The DC( ) sets duty cycle in percent, not angle. So you have to use datasheet of

                     

                  servo to figure out what DC you need to get what angle. Nominally a servo runs

                     

                  a PW of 1 - 2 mS in a 20 mS period, so

                     

                   

                     

                  1 mS =~  - 90 =    5%    DC

                     

                  1.5 mS =~   0 =    7.5% DC

                     

                  2 mS =~ + 90 = 10%     DC

                     

                   

                     

                  Are you still using Atmet UP to do this ?

                     

                   

                     

                  Regards, Dana.

                  • 81. Re: Simple PWM
                    ki.leung

                     Do you have any tools to meansure the output of PSoC? 

                       

                    Hoiw about 

                       

                    while (1){ 

                       

                    turn on P0_0;

                       

                    delay 5 seconds;

                       

                    turn off P0_0;

                       

                    delay 5 seconds,

                       

                       

                    If you have a CRO, use the CRO to check what is the output level of P0_0.

                       

                    If no CRO, then use a mutlimeter to see if the output does change. This should confirm if the output of PSoC is not dead and in the right drive mode. 

                    • 82. Re: Simple PWM
                      riko.husin

                      unfortunately I don't have osciloscope to see what happened here...

                         

                      yes, I'm still using atmel, and still work well for me,

                         

                      try to migrate to cypress but no luck until now...

                      • 83. Re: Simple PWM
                        mohamedmongihajjej_2408286

                        HELLO I am new here i have a problem with my project

                           

                        i have 5 servo (type  9g)  i want to control them by ADC in my Psoc 5lp card  (0 TO 180 ° )

                           

                        the secound part of my project it to use UART data to controle another card Psoc 5lp (to controle a hand)

                           

                        thnks and sorry for my English 

                           

                           

                        • 84. Re: Simple PWM
                          user_1377889

                          Welcome in the forum.

                             

                          Not a good idea to hijack a 4 year old thread in the wrong forum. Better re-post in PSoC5 forum as a new thread. This will ensure that the right "Gurus" see your question.

                             

                          I can assure you that your PSoC5 is able to control those servos.

                             

                           

                             

                          Bob

                          1 2 3 4 5 6 Previous Next