This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Now need pwm_driver demo5 duty ratio, is there any way to 1/6 or 1/8?

How do you do Now need pwm_driver demo5 duty ratio, is there any way to 1/6 or 1/8?PWM and phase difference is 4 road? Ask for a few days, change seq_values [], but how to change?Try to success.

image description

Parents
  • You can create a new array of nrf_pwm_values_individual_t , and the use this to update the pwm duty ratio.

    static nrf_pwm_values_individual_t /*const*/ seq_values_new[] =
    {
        { 2000 ,      0,      0,      0 },
        {      0, 0x8000,      0,      0 },
        {      0,      0, 0x8000,      0 },
        {      0,      0,      0, 0x8000 }
    };
    
    nrf_pwm_values_t new_pwm_values; 
    
    new_pwm_values.p_individual = seq_values_new;
    
     nrf_drv_pwm_sequence_values_update(&m_pwm0,1,new_pwm_values);
    
Reply
  • You can create a new array of nrf_pwm_values_individual_t , and the use this to update the pwm duty ratio.

    static nrf_pwm_values_individual_t /*const*/ seq_values_new[] =
    {
        { 2000 ,      0,      0,      0 },
        {      0, 0x8000,      0,      0 },
        {      0,      0, 0x8000,      0 },
        {      0,      0,      0, 0x8000 }
    };
    
    nrf_pwm_values_t new_pwm_values; 
    
    new_pwm_values.p_individual = seq_values_new;
    
     nrf_drv_pwm_sequence_values_update(&m_pwm0,1,new_pwm_values);
    
Children
No Data
Related