News:

  • April 29, 2026, 09:48:49 AM

Login with username, password and session length

Author Topic: Do-More PWM  (Read 12539 times)

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Do-More PWM
« on: February 21, 2025, 08:20:10 AM »
We have a project building a test setup for a customer.  The desired output is PWM but they would like to be able to vary the frequency as well as pulse width.  The current plan is to use multiple PWM outputs with preselected frequencies selected by a recipe since the PWM block doesn't allow a variable for the frequency, only a constant.  Is there some programable method to do this?  I am kind of think maybe using a high speed pulse output combined with a high speed timer for pulse width, essentially building a PWM output of our own.

On a really positive note we are really pleased with the BRX PLCs.  We keep throwing all kinds of strange requirements at them and they just DO-MORE.  Vendors come in and ask why we aren't using X,Y or Z and are always impressed when we explain how capable the BRX is.  A recent request for us to use a different PLC shows it will cost about $4000 more to get what we need!

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3806
    • Host Engineering
Re: Do-More PWM
« Reply #1 on: February 21, 2025, 09:38:18 AM »
The PWM block doesn't allow a variable for the frequency, only a constant.

Sorry about that.  PWMOUT was set up to provide a simple way to set up a PWM with a constant frequency but be able to change the duty cycle.  I would recommend not using the PWMOUT but just manipulate the PERIOD (not frequency) as an INTEGER in MILLISECONDs or MICROSECONDs (units are DYNAMIC - see the .PeriodScale in the PWM Out heap item, e.g. $PWMOut1.PeriodScale.)

Look at Help Topic DMD0408 BRX Pulse Width Modulated Outputs for how to easily control the "frequency" as a Period in milliseconds or microseconds.  The .PeriodScale manipulation is CRITICAL (along with the proper unit value for .Period) when manipulating the Frequency at runtime.

PWMOUT was also created as a place holder for Cross Reference of your PWM configuration.  You could technically still use it, just make sure your PWMOUT box is BEFORE the direct manipulation of the $PWMOut1 structure members (last one wins).

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6154
  • Yes Pinky, Do-more will control the world!
Re: Do-More PWM
« Reply #2 on: February 21, 2025, 10:00:39 AM »
We have a project building a test setup for a customer.  The desired output is PWM but they would like to be able to vary the frequency as well as pulse width.  The current plan is to use multiple PWM outputs with preselected frequencies selected by a recipe since the PWM block doesn't allow a variable for the frequency, only a constant.  Is there some programable method to do this?  I am kind of think maybe using a high speed pulse output combined with a high speed timer for pulse width, essentially building a PWM output of our own.

On a really positive note we are really pleased with the BRX PLCs.  We keep throwing all kinds of strange requirements at them and they just DO-MORE.  Vendors come in and ask why we aren't using X,Y or Z and are always impressed when we explain how capable the BRX is.  A recent request for us to use a different PLC shows it will cost about $4000 more to get what we need!

The PWMOUT box just sets the structure fields of the structure associated with the PWM...it's simply a convenience. You can set the frequency directly in the structure...and yes, it is a variable.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: Do-More PWM
« Reply #3 on: February 21, 2025, 09:36:56 PM »
Great!
Check off another box on the Can-Do list.