Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Cancel PWM signal

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
4 postsPage 1 of 1
4 postsPage 1 of 1

Cancel PWM signal

Post by dragonax » Tue Sep 07, 2010 7:31 am

Post by dragonax
Tue Sep 07, 2010 7:31 am

is there any way to cancel the pwm signal once started? in the following code I tried "break" while loop doesn't work


Code: Select all
    rcservo_SendPWMPulses(channel, period, duty, count);

    while(rcservo_IsPWMCompleted(channel) == false){
      break;
    }
is there any way to cancel the pwm signal once started? in the following code I tried "break" while loop doesn't work


Code: Select all
    rcservo_SendPWMPulses(channel, period, duty, count);

    while(rcservo_IsPWMCompleted(channel) == false){
      break;
    }
dragonax
Savvy Roboteer
Savvy Roboteer
Posts: 35
Joined: Sat Sep 04, 2010 7:46 pm

Re: Cancel PWM signal

Post by roboard » Tue Sep 07, 2010 4:03 pm

Post by roboard
Tue Sep 07, 2010 4:03 pm

dragonax wrote:is there any way to cancel the pwm signal once started? in the following code I tried "break" while loop doesn't work


Currently, no PWM-mode API in RC servo lib of RoBoIO can stop PWM pulses directly. But you can try the following trick:

Code: Select all
    rcservo_SendPWMPulses(channel, period, duty, count);
    ....
    //trick to cancel PWM pulses of the last rcservo_SendPWMPulses(cannel, ...) call
    rcservo_SendPWMPulses(channel, period, duty, 1L);
    while(rcservo_IsPWMCompleted(channel) == false);
dragonax wrote:is there any way to cancel the pwm signal once started? in the following code I tried "break" while loop doesn't work


Currently, no PWM-mode API in RC servo lib of RoBoIO can stop PWM pulses directly. But you can try the following trick:

Code: Select all
    rcservo_SendPWMPulses(channel, period, duty, count);
    ....
    //trick to cancel PWM pulses of the last rcservo_SendPWMPulses(cannel, ...) call
    rcservo_SendPWMPulses(channel, period, duty, 1L);
    while(rcservo_IsPWMCompleted(channel) == false);
roboard
Savvy Roboteer
Savvy Roboteer
Posts: 302
Joined: Fri Jul 03, 2009 4:44 am

Post by dragonax » Tue Sep 07, 2010 4:13 pm

Post by dragonax
Tue Sep 07, 2010 4:13 pm

Thanks i'll try that.

is it wrong if I use pwm_SetPulseCount and include the pwm.h unit
Thanks i'll try that.

is it wrong if I use pwm_SetPulseCount and include the pwm.h unit
dragonax
Savvy Roboteer
Savvy Roboteer
Posts: 35
Joined: Sat Sep 04, 2010 7:46 pm

Post by roboard » Wed Sep 08, 2010 4:29 am

Post by roboard
Wed Sep 08, 2010 4:29 am

dragonax wrote:is it wrong if I use pwm_SetPulseCount and include the pwm.h unit


It is not suggested to use RC servo lib (including rcservo_SendPWMPulses()) and PWM lib (including pwm_SetPulseCount()) at the same time, because this may confuse the internal states of the two lib.

:)
dragonax wrote:is it wrong if I use pwm_SetPulseCount and include the pwm.h unit


It is not suggested to use RC servo lib (including rcservo_SendPWMPulses()) and PWM lib (including pwm_SetPulseCount()) at the same time, because this may confuse the internal states of the two lib.

:)
roboard
Savvy Roboteer
Savvy Roboteer
Posts: 302
Joined: Fri Jul 03, 2009 4:44 am


4 postsPage 1 of 1
4 postsPage 1 of 1