News:

  • October 01, 2025, 01:31:38 PM

Login with username, password and session length

Author Topic: How to generate PWM from the BRX  (Read 2500 times)

Mitch IFM

  • Newbie
  • *
  • Posts: 2
How to generate PWM from the BRX
« on: June 30, 2018, 06:20:37 PM »
After reading the help files etc. I can find no way to establish the parameters for PWM.  I think you have to get to the Heap Item but I'm totally lost.  Which Instruction is used for this purpose??  Not trying to do anything mechanical like axis. Just need a PWM pulse train. Thanks in advance.

Mitch

Mike Nash

  • Hero Member
  • *****
  • Posts: 645
Re: How to generate PWM from the BRX
« Reply #1 on: June 30, 2018, 06:48:40 PM »
There is not an instruction for PWM. I would set up the PWM output from Dashboard, click on HSIO on the BRX picture, then choose the Y0 etc, for the output.

Now you use the structure the above selection creates for you as elements in whatever devicename you gave it (say default is PWMOut1) then in your ladder you would enable the output by setting $PWMOut1.EnableOutput true as a coil or set or whatever. The other elements might be a MATH or MOVE to $PWMOut1.DutyCycle.

Mitch IFM

  • Newbie
  • *
  • Posts: 2
Re: How to generate PWM from the BRX
« Reply #2 on: June 30, 2018, 06:55:03 PM »
Thank you so much Mike!  I will give it a try.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6123
  • Yes Pinky, Do-more will control the world!
Re: How to generate PWM from the BRX
« Reply #3 on: June 30, 2018, 07:00:28 PM »
1. Left click on the HSIO tab in the upper left of the CPU in the Dashboard.
2. Select PWM 1, 2, or 3 from the High Speed I/O setup page.
3. Select "Enable PWM" and assign the outputs. Optionally rename the device. Note the Heap Item name, something like $PWMOut1.
4. After accepting the config changes, the system creates the heap item, which is what you use to control the PWM.

There are no instructions associated with the PWM, just the heap item. Set 'EnableOutput' to start it. 'PeriodScale' let's you change the time scale that defines the PWM period between microseconds or milliseconds. 'Period' is the PWM period defined in us or ms. 'DutyCycle' is a floating point value that specifies the duty cycle as a value from 0.0 to 100.0.

Check out help topic DMD0408.

"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