Author Topic: PWM period control with rotary encoder - What does a user expect?  (Read 1280 times)

0 Members and 1 Guest are viewing this topic.

Offline 741Topic starter

  • Frequent Contributor
  • **
  • Posts: 406
  • Country: gb
    • Circuit & PCB Design (small PCB quantities OK)
I've written code to support altering PIC161x PWM period (and duty) via a rotary encoder.

For the duty it seems clear the user does indeed want to adjust duty time, so encoder movement maps simply to duty change. For the period, I am uncertain what seems natural.

As I tried adjusting PWM period, I found I actually expected control of frequency, but only to get to a ball-park value. After that, and with the 'scope timebase set appropriately, I then required good control of period.

Because f = 1/t, it takes ages to wind frequency down to minimum, but going from half to full frequency is very fast.

  • Perhaps slow turns imply period-centric control, fast turns imply frequency-centric control?

Offline rhodges

  • Frequent Contributor
  • **
  • Posts: 354
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
Re: PWM period control with rotary encoder - What does a user expect?
« Reply #1 on: August 19, 2019, 03:59:01 pm »
I am currently working on a PWM project for controlling a small motor and pump. I am using a combination display and keypad, but I can easily pretend I am turning a knob.

I just picked 10khz and it looks pretty good on the scope. For my project.  But as you imply (I think), it might be useful to change the PWM frequency to find what is ideal. And then, control the duty cycle. Maybe even going back and forth repeatedly.

So I would like to see a display that I can switch between duty cycle and PWM frequency. The button on the rotary encoder would be an obvious way to switch back and forth. The display would show maybe "F" and "P" (assuming a simple 7-segment module) to indicate frequency or PWM duty. Yes, it should be obvious that a 3-digit number (0% to 100%) is duty cycle and a 5-digit number is a frequency... But why not?
Currently developing embedded RISC-V. Recently STM32 and STM8. All are excellent choices. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf